Thursday, 4 February 2010

Latex for each loops.

Credit to Gavin for this one.

To create a for loop, iterating over a list:

\def\freqlist{17000,17100,17200,17300}

\foreach \freq in \freqlist
{
%\input{chapters/\TeXName}
\freq
}

This was used to select filenames for multiple image imports; the images
were generated externally and were named according to the frequency.

2 comments:

  1. \foreach is not a native LaTeX command. I guess some package must be included for this code to work. Can you comment?

    ReplyDelete
  2. It works for me when including the tikz package.

    ReplyDelete