I'm trying to have a number of lists using etoolbox that I process near the end of a document. There may be a large number of these lists, and I do not know how many I will have beforehand, so I have been trying to use a number in the list name to keep track of everything.
With the code below, I am probably doing something horribly wrong, it is just not obvious to me what that is.
\documentclass{article}
\usepackage{etoolbox}
\begin{document}
\csdef{foo1}{}
\csdef{foo2}{}
\listcsadd{\csname foo1\endcsname}{first}
\listcsadd{\csname foo2\endcsname}{second}
\dolistcsloop{\csname foo1\endcsname}
\end{document}
This print "firstsecond", but I only expected it to print "first". The same thing happens if I only try to print the second list. What do I need to change to make it behave as I would expect?
\csdefseem unnecessary. – egreg Jun 13 '12 at 22:21