I need to split comma-separed string from variable (actually data file) for further procesing.
There is MWE:
\documentclass{article}
\usepackage{csvsimple}
\usepackage{xparse}
\usepackage{filecontents}
\begin{filecontents*}{sample.csv}
colA;
A,B,C;
\end{filecontents*}
\NewDocumentCommand{\myfunc}{ >{\SplitList{,}} m }{\ProcessList{#1}{\func}}
\NewDocumentCommand{\func}{m}{\fbox{#1}}
\newcommand{\textA}{a,b,c}
\begin{document}
\parindent=0pt
(1) \myfunc{a,b,c}\\ % OK
(2) \myfunc{\textA}\\ % Wrong
(3) \expandafter\myfunc\expandafter{\textA}\\ % OK
\csvreader[
head to column names,
separator=semicolon
]{sample.csv}{}%
{
(4) \expandafter\myfunc\expandafter{\colA} % Wrong (how to correct?)
}
\end{document}
What is the correct way to expand argument in case (4) in the same way as (1) or (3)??
Thank you very much in advance for any help or suggestion!
Best regards,
Lubos
expl3: for instance (between\ExplSyntaxOnand\ExplSyntaxOff) one could do(4) ~ \exp_args:Nf \myfunc { \colA }to fully expand\colAon the left. (Note I used~for the space after(4).) – Bruno Le Floch Aug 09 '16 at 18:05