From: hank@ducvax.auburn.edu
Subject: Re: HELP on LaTeX macro
Organization: Auburn University, AL
Date: Thu, 19 Nov 1992 23:38:43 GMT

In article <1992Nov19.112431.7525@inesc.pt>, njm@thor.inesc.pt (Nuno Joao Mamede) writes:
> I would like to use a command in LaTeX with an argument specifying how
> many times other command shoud be executed.
> How can I define such a loop in LaTeX (TeX)?

EVERYONE, get DM Jones' tex-index:
 archive.cs.ruu.nl:TEX/DOC/TeX-index.Z
 ftp.th-darmstadt.de:
        pub/tex/documentation/styles-and-macros.Index.Z
 ftp.math.utah.edu:pub/tex/tex-index
 ftp.uni-stuttgart.de:/soft/tex/documentation/TeX-index
 ftp.diku.dk:pub/TeX/misc/TeX-Index.Z
 Niord.SHSU.edu:[fileserv.tex-index]tex.index
 TeX.ac.uk:[tex-archive.doc]TeX-index.txt
 ymir.claremont.edu:[anonymous.tex.documentation]tex-index.txt

Look for 'loop'. Some old, untested macros which do not appear in the 
tex-index follow.

% Date: Wed,  9 Nov 88 14:07:12 CST
% From: J E PITTMAN <JEPTEX@venus.tamu.edu>
% Subject: TeX Inputs loopy.tex (nested loop constructs)
% Keywords: macros, TeX
 
% File:       TeX Inputs loopy.tex
% Author:     J E Pittman
% Bitnet:     JEPTeX@TAMVenus
% Internet:   JEPTeX@Venus.TAMU.EDU
% Date:       September 29, 1988
%
% These macros supply structured, nested loop constructs as follows:
%
%     \forcount \csname=number to number by number do
%        valid_TeX_input
%        \endfor \csname
%
%     \while \csname \if_of_any_type do
%        valid_TeX_input
%        \endwhile \csname
%
%     \whilenot \csname \if_of_any_type do
%        valid_TeX_input
%        \endwhile \csname
%
% The \csname for the for loop must refer to a count register, for the
% while loops it must uniquely identify the while loop.
%
\def\forcount #1{\relax
   \def
         \for #1=##1to ##2by ##3do
            ##4%
            \endfor #1%
      {\relax
      #1=##1\relax
      \ifnum ##3>0
         \whilenot #1\ifnum ##2<#1do
            ##4%
            \advance #1 by ##3\relax
            \endwhilenot #1%
      \else
         \while #1\ifnum ##2<#1do
            ##4%
            \advance #1 by ##3\relax
            \endwhile #1%
      \fi
      }%
   \for #1%
   }%
%
\let\endwhilenot=\fi
%
\def\whilenot #1{\relax
   \def
         \whilenotloop#1 ##1do
            ##2%
            \endwhilenot #1%
      {\relax
         \expandafter\def\csname whilenotbody\string#1\endcsname{##2}%
         \expandafter\def\csname whilenotloop\string#1\endcsname
            {\relax
               ##1%
                  \let\next=\relax
               \else
                  \csname whilenotbody\string#1\endcsname
                  \expandafter\let\expandafter\next
                        \csname whilenotloop\string#1\endcsname
               \fi
               \next
               }%
         \csname whilenotloop\string#1\endcsname
         }%
   \whilenotloop#1
   }%
%
\let\endwhile=\fi
%
\def\while #1{\relax
   \def
         \whileloop#1 ##1do
            ##2%
            \endwhile #1%
      {\relax
         \expandafter\def\csname whilebody\string#1\endcsname{##2}%
         \expandafter\def\csname whileloop\string#1\endcsname
            {\relax
               ##1%
                  \csname whilebody\string#1\endcsname
                  \expandafter\let\expandafter\next
                        \csname whileloop\string#1\endcsname
               \else
                  \let\next=\relax
               \fi
               \next
               }%
         \csname whileloop\string#1\endcsname
         }%
   \whileloop#1
   }%
%
\endinput



-- 
--Darrel Hankerson hank@ducvax.auburn.edu
From: lhb@hplb.hpl.hp.com (Leon Bouwmeester)
Date: Wed, 18 Nov 1992 10:22:15 GMT
Subject: WANTED: bigpiclatex
Organization: Hewlett-Packard Company