For Loop
For Loop
1
\forloop
Implementation
\forloop[ step ]{ counter }{ initial value }{ condition }{ code } \newcounter{ct} \forloop{ct}{1}{\value{ct} < 10}{\arabic{ct} } 123456789
\newcommand{\forloop}[5][1]% {% 3 \setcounter{#2}{#3}% 4 \ifthenelse{#4}% 5 {% 6 #5% 7 \addtocounter{#2}{#1}% 8 \forloop[#1]{#2}{\value{#2}}{#4}{#5}% 9 }%
1 2
Else
10 11 12
{% }% }%
\forLoop
24 25 26 27 28 29 30 31
Change History
v1.0 General: Initial Release . . . . . . . . 1 v2.0 General: Re-wrote forloop command after discovering that whiledo took too many resources . . . . . . . . . . . . . . . . . . 1 v3.0 General: total restructure of forloop command to make nested loops work . . . . . . . . . . . . . . . . . . . 1
Index
Numbers written in italic refer to the page where the corresponding entry is described; numbers underlined refer to the code line of the denition; numbers in roman refer to the code lines where the entry is used.
F \forLoop . . . . . . . . . . . . . . . . . . . . \forloop . . . . . . . . . . . . . . . . . . . . . 1 13