Changes

Jump to navigation Jump to search
Created page with "Documentation for \iftrialtypesetting"
<cd:commandgroup name="iftrialtypesetting" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807">
<cd:shortdesc>The command <tt>\iftrialtypesetting</tt> is a test for non-final typesetting passes
</cd:shortdesc>
<cd:variants>
<cd:command category="system" file="syst-aux.mkiv" interfacedate="2020-07-14T09:24" interfacefile="i-system.xml" keywords="conditional" level="system" name="iftrialtypesetting" variantnumber="1">
<cd:arguments>
<cd:keywords delimiters="none" ordinal="1">
<cd:keywordsdoc></cd:keywordsdoc>
<cd:constant type="cd:true"></cd:constant>
</cd:keywords>
<cd:delimiter name="else" ordinal="2"></cd:delimiter>
<cd:keywords delimiters="none" ordinal="3">
<cd:keywordsdoc></cd:keywordsdoc>
<cd:constant type="cd:false"></cd:constant>
</cd:keywords>
<cd:delimiter name="fi" ordinal="4"></cd:delimiter>
</cd:arguments>
</cd:command>
</cd:variants>
<cd:description>ConTeXt sets the <tt>\iftrialtypesetting</tt> 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 <tt>\iftrialtypesetting</tt> 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 <tt>\iftrialtypesetting\else</tt> is useful, but TABLE is the most common case.
</cd:description>
<cd:examples><cd:example title="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
</cd:example></cd:examples>
<cd:notes></cd:notes>
<cd:seealso>
<cd:source file="syst-aux.mkiv" originator="system"></cd:source>
<cd:wikipage originator="system" page="Category:System"></cd:wikipage>
<cd:wikipage originator="system" page="Keywords:Conditional"></cd:wikipage></cd:seealso>
</cd:commandgroup>

Navigation menu