When passing a comma-separated list the commas are ignored, i.e. the list becomes a single item and I can't seem to find a way to prevent this. What should I do so that TEST C in the attached code will achieve the expected result of "extratcting" the itmes in the list?.
\documentclass{article} \usepackage{pgffor} \newcommand{\setstr}[2]{\expandafter\def\csname#1\endcsname{#2}} \newcommand{\getstr}[1]{\csname#1\endcsname} \newcommand{\PROCESS}[1] { The list items are: \foreach \i in {#1} { (\i) } } \newcommand{\SETC}[2]{\setstr{C#1}{#2}} \newcommand{\RUN}[1]{ \expandafter\PROCESS\expandafter{\getstr{C#1}} } \begin{document} % % The following works % \noindent{TEST A:} \PROCESS{a,b,c,d} \newline % % and the following also works % \noindent{TEST B:} \newcommand{\A}{a,b,c,d} \expandafter\PROCESS\expandafter{\A} \newline % % but this does not work % \noindent{TEST C:} \SETC{1}{a,b,c,d}% \RUN{1}% \newline \end{document} 

minimalmust not be used forever.\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\PROCESS\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter{\getstr{C#1}}for\RUNwill work. (This is an expansion issue.) But it might be easier to create a slightly different macro that handle a list stored in a macro. (Just likepgfforitself:\foreach \i in {<list>}vs\foreach \i in \listMacro.)