Changes

Jump to navigation Jump to search
Using 2 pass tag processing (\defineXMLenvironmentsave,\XMLflush)
== Two pass XML tag processing example ==
 
Imagine the next XML structure:
\startXMLdata<xmlcode>
<float>
<figure file="hacker.jpg" context="width=3cm" />
<caption>Cow and hacker.</caption>
</float>
\stopXMLdata</xmlcode>
There can be arbitrary number of figures inside a <float > tag. All figures share a single caption. It is desired to typeset them using \placefigure and several \externalfigure. See also relative width specification for th second figure width to (.5\textwidth).
Solution is by two pass <float> processing (saving via \defineXMLenvironmentsave and flushes via \XMLflush) with different <caption> and <figure> definitions:
<texcode>
\starttext
\startXMLdata
</texcode>
<xmlcode>
<float>
<figure file="cow.pdf" context="width=.5&ctx-var-textwidth;" />
<caption>Cow and hacker.</caption>
</float>
</xmlcode>
<texcode>
\stopXMLdata
\stoptext
</texcode>
31

edits

Navigation menu