diff options
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/forloop/forloop.dtx | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/Master/texmf-dist/source/latex/forloop/forloop.dtx b/Master/texmf-dist/source/latex/forloop/forloop.dtx index 35d6843124f..317f63733c3 100644 --- a/Master/texmf-dist/source/latex/forloop/forloop.dtx +++ b/Master/texmf-dist/source/latex/forloop/forloop.dtx @@ -2,7 +2,7 @@ % %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{forloop} -%<package> [2006/09/17 v1.0 For Loops for LaTeX] +%<package> [2006/09/18 v3.0 For Loops for LaTeX] %<package>\RequirePackage{ifthen} % % @@ -40,6 +40,8 @@ %% Right brace \} Tilde \~} % % \changes{v1.0}{2006/09/17}{Initial Release} +% \changes{v2.0}{2006/09/18}{Re-wrote forloop command after discovering that whiledo took too many resources} +% \changes{v3.0}{2006/09/18}{total restructure of forloop command to make nested loops work} % % \GetFileInfo{forloop.sty} % @@ -85,32 +87,30 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \begin{macro}{\forloop} -% |\forloop|\oarg{step}|{|\meta{counter}|=|\meta{value}|}|\marg{condition}\marg{code}. +% |\forloop|\oarg{step}\marg{counter}\marg{initial value}\marg{condition}\marg{code} % -% In action: |\forloop{testct=1}{\value{testct} < 3}{\arabic{testct}}| -% \newcounter{testct} \forloop{testct=1}{\value{testct} < 3}{\arabic{testct}} -% +% |\newcounter{ct} \forloop{ct}{1}{\value{ct} < 10}{\arabic{ct} }| +% +% \newcounter{ct} \forloop{ct}{1}{\value{ct} < 10}{\arabic{ct} } % \begin{macrocode} -\newcommand{\forloop}[4][1]% +\newcommand{\forloop}[5][1]% {% -\forloop@split#2\%% -\setcounter{\forloop@ct@name}{\forloop@ct@initialvalue}% -\whiledo{ #3 }% +\setcounter{#2}{#3}% +\ifthenelse{#4}% {% - #4% - \addtocounter{\forloop@ct@name}{#1}% + #5% + \addtocounter{#2}{#1}% + \forloop[#1]{#2}{\value{#2}}{#4}{#5}% }% -}% % \end{macrocode} -% \end{macro} -% -% +% Else % \begin{macrocode} -\def\forloop@split#1=#2\%{% -\gdef\forloop@ct@name{#1}% -\gdef\forloop@ct@initialvalue{#2}% + {% + }% }% % \end{macrocode} +% \end{macro} +% % % \begin{macro}{\forLoop} % |\forLoop|\oarg{step}\marg{start}\marg{stop}\marg{counter name}\marg{code} |