It is likely that the answer to the problem is buried on this site somewhere -- it is my limited understanding of macro expansion which seems to defy my search foo...
I am trying to define macros which I can use like this:
\begin{document} \AimTaskDef{1}{task 1} \AimTaskAdd{1}{task 2} \AimTaskDef{2}{task 3} \AimTaskAdd{2}{task 4} ... % later, in some table \AimTaskGet{1} \AimTaskGet{2} Which should result in output like this
\begin{itemize} \item task 1 \item task 2 \end{itemize} \begin{itemize} \item task 3 \item task 4 \end{itemize} I have the following macro set in place:
\def\AimTaskDef#1#2{% \expandafter\def\csname AimTask#1\endcsname{ \item #2} } \def\AimTaskAdd#1#2{% \expandafter\def\tmp{\expandafter\csname AimTask#1\endcsname} \expandafter\def\csname AimTask#1\endcsname{ \tmp \item #2} } \def\AimTaskGet#1{ \begin{itemize} \csname AimTask#1\endcsname \end{itemize} } I am doing something wrong with the 'tmp' definition/usage, as I see the following errors:
\AimTaskAdd #1#2->\expandafter \def \tmp {\expandafter \csname AimTask#1\end... l.28 \AimTaskAdd{1}{task 2} ? ! Missing control sequence inserted. <inserted text> \inaccessible l.28 \AimTaskAdd{1}{task 2} ? and the result contains only the last specified task. I would appreciate any insight in what is going on with \tmp.
Many thanks, Andre.

\expandafter\def\tmp. The\expandafterskips\defand tries to expand\tmpwhich hasn't been defined. I get an undefined control sequence at that point when copy/pasting your code into a document.