I have some sort of a list and want to add the actual enumi-count to that list. I assume, that in my problem I'm somehow just storing the pointer to that counter and not the value itself, so even the stored counter-value increases as the counter itself increases. I even tried definining a tempcounter I set to the value of the enumi-counter, but I've read somewheere, that I should expand the counter, so I'm clueless what to do.
\documentclass{scrartcl}
\usepackage{ifthen}
\def\aliste{}
\def\zaliste#1\relax{\gdef\aliste{#1}}
\def\addtoaliste#1{%
\ifthenelse{\equal{\aliste}{}}{%
\expandafter\zaliste\aliste#1\relax
}{\expandafter\zaliste\aliste,#1\relax
}%
}
\begin{document}
Value: \aliste\\
\addtoaliste{A}
Value: \aliste\\ %Returns A
\begin{enumerate}
\item
Output: \arabic{enumi}\\ %is 1
\addtoaliste{\arabic{enumi}} %adds 1 to the list
\aliste %returns A,1
\item
Output: \arabic{enumi}\\ %is 2
\addtoaliste{\arabic{enumi}} %shall add 2 to the list
Value: \aliste %returns A,2,2
\end{enumerate}
Value: \aliste %returns A,2,2
\end{document}