Difference between revisions of "Command/iftrialtypesetting"

From Wiki
Jump to navigation Jump to search
(Created page with "Documentation for \iftrialtypesetting")
(No difference)

Revision as of 13:32, 8 May 2024


\iftrialtypesetting

Summary

The command \iftrialtypesetting is a test for non-final typesetting passes

Settings

\iftrialtypesetting ... \else ... \fi
... true
\elsedelimiter
... false
\fidelimiter

Description

ConTeXt sets the \iftrialtypesetting to true when it knows that the current typesetting event (box packaging) is not the final result that will be sent to the output file, but instead is some internal action that is only executed in support of another task like measuring typeset text widths.

Using \iftrialtypesetting as a test for non-final typesetting passes is especially useful inside TABLEs. If a counter is incremented inside of a TABLE cell, it may be incremented multiple times accidentally while TABLE tries to figure out the required column widths.

There are other situations where \iftrialtypesetting\else is useful, but TABLE is the most common case.

Examples

Simple example

\definecounter[EventCount]

Event: \rawcountervalue[EventCount]

\startTABLE[|p|] \NC Event: \rawcountervalue[EventCount]

   \incrementcounter[EventCount]

\NC\NR \NC Event: \rawcountervalue[EventCount]

   \iftrialtypesetting\else\incrementcounter[EventCount]\fi

\NC\NR \stopTABLE

Notes

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: