This question is kind-of follow-up to answer given to this question: How to iterate over a comma separated list?
The difference is, that I want to iterate over a csv list stored in a macro \myTerms. In following MWE the list in \myTerms seems to be taken literally and not parsed as a CSV. I tryed to fix it with \expanded{}, but it doesnt seem to work.
MWE:
\documentclass{article}
\ExplSyntaxOn
\NewDocumentCommand{\myList}{mm}
{
\clist_set:Nn \l_tmpa_clist { #1 }
\clist_use:Nnnn \l_tmpa_clist { #2 } { #2 } { #2 }
}
\ExplSyntaxOff
\newcommand{\mySeparator}{\textbullet}
\newcommand{\makeMyList}[1]{
\begingroup
\scshape\myList{#1}{\mySeparator}
\endgroup
}
\newcommand{\myTerms}{test, another test}
\begin{document}
\makeMyList{\expanded{\myTerms}}
\end{document}
Desired output is achieved when I am not using macro myTerms and simply write out the list to \makeMyList argument, like so:
Desired output:
\documentclass{article}
\ExplSyntaxOn
\NewDocumentCommand{\myList}{mm}
{
\clist_set:Nn \l_tmpa_clist { #1 }
\clist_use:Nnnn \l_tmpa_clist { #2 } { #2 } { #2 }
}
\ExplSyntaxOff
\newcommand{\mySeparator}{\textbullet}
\newcommand{\makeMyList}[1]{
\begingroup
\scshape\myList{#1}{\mySeparator}
\endgroup
}
\begin{document}
\makeMyList{test, another test}
\end{document}
That led me to think that expansion control with \expanded{} is needed, but I seem to be making a different mistake. How can I fix that?
