Changes

Jump to navigation Jump to search
m
no edit summary
number.
=== <{{cmd>|dorecurse</cmd> }} ===
<texcode>
\dorecurse {n} {whatever we want}
used in situations where Plain TeX's <code>\loop</code> macro
ungracefully fails. The current value of the counter is
available stored in <code>\recurselevel</code>, before as well as afterand is available for use anywhere within the second parenthesis where <code>whatever we want</code> stufftext is found.
<context source="yes">
Both <code>\recurselevel</code> and <code>\recursedepth</code> are
macros. The real conters counters are hidden from the user because
we don't want any interference.
=== {{cmd|doloopoverlist}} ===
<texcode>
\doloopoverlist {a, b, c} {current letter is: “\recursestring”\par}
</texcode>
 
As the command name reads, it loops over the list values.
 
<context source="yes">
\doloopoverlist
{a, b, c}
{current letter is: “\recursestring”\par}
</context>
 
{{cmd|recursestring}} is used instead of {{cmd|recurselevel}}.
 
<context source="yes">
\doloopoverlist{\tf,\ss,\tt}
{\bgroup\recursestring\doloopoverlist{\rm,\it,\bf,\bi,\sc}
{\bgroup\recursestring a̱ḇc̱ a̲b̲c̲\quad\egroup}\egroup\par}
</context>
 
It also allows commands, as contained in the previous code snippet.
=== <{{cmd>|dostepwiserecurse</cmd> }} ===
The simple command <code>\dorecurse</code> is
a special case of the more general:
</texcode>
=== <{{cmd>|doloop</}} {{cmd> <cmd>|exitloop</cmd> }} ===
Sometimes loops are not determined by counters, but by
(a combinations of) conditions. We therefore implement a
</texcode>
When needed, one can call for <code>\looplevelrecurselevel</code> and<code>\loopdepthrecursedepth</code>.
The loop is executed at least once, so beware of situations
</context>
For further discussion on loops and expansion, see [[System_Macros/Expansion_Control|Expansion control]] as well as this [http://randomdeterminism.wordpress.com/2009/03/05/tex-programming-the-past-the-present-and-the-future/ blog post].
< '''Prev:''' [[System Macros/Branches and Decisions|Brancjes Branches & Decisions]] | '''Top:''' [[System Macros]] | '''Next:''' [[System Macros/Action Processing|Action Processing]] >
[[Category:ConTeXt programmingProgramming and Databases]][[Category:Inside ConTeXtTools]]
4

edits

Navigation menu