summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/forloop
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-09-20 20:15:47 +0000
committerKarl Berry <karl@freefriends.org>2006-09-20 20:15:47 +0000
commitb927724b1d2d9dde0af151e16b0643f0109f6100 (patch)
treeb51ab484ed65843bd1a24463ed9d971cc87712a0 /Master/texmf-dist/source/latex/forloop
parent6a6d5f181aa8135830479076d5d8ecec404c9241 (diff)
forloop update (20sep06)
git-svn-id: svn://tug.org/texlive/trunk@2170 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/forloop')
-rw-r--r--Master/texmf-dist/source/latex/forloop/forloop.dtx36
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}