You can iterate through a comma-separated list of items with
\for
.
Here is an example:
\for\name:=karl,kathy\do{% \message{\name}% }%
This writes `karl' and `kathy' to the terminal. Spaces
before or after the commas in the list, or after the :=
, are
not ignored.
\for
expands the iterated values fully (with \edef
), so
this is equivalent to the above:
\def\namelist{karl,kathy}% \for\name:=\namelist\do ...