I want to create a new command, that has more than 9 arguments. Therefore, i am using \NewDocumentComannd and comma separated lists. With this new command i use \pgfmathsetmacro, too. A simplified (working) example code looks like this:
\documentclass[12pt]{article}
\usepackage{pgfmath}
\ExplSyntaxOn
\NewDocumentCommand{\test}{mm}
{
\exp_args:Nne\pgfmathsetmacro{\expression} % Instead of naming the macro “\expression”, i want to give the macro a name depending on an element of a comma separated list
{
\clist_item:nn{#2}{1}
}
\expression
}
\ExplSyntaxOff
\begin{document}
\test{pa}{1,2,3}
\end{document}
I am trying to do something like this:
\documentclass[12pt]{article}
\usepackage{pgfmath}
\ExplSyntaxOn
\NewDocumentCommand{\test}{mm}
{
\exp_args:Nne\pgfmathsetmacro{\clist_item:nn{#1}{1}x} % Here i try to create a macro named “\pax” (“pa” is an element of a list (see below: \test{pa}{1,2,3}) and “x” is just added to this element)
{
\clist_item:nn{#2}{1}
}
\csname\clist_item:nn{#1}{1}x\endcsname % Here i try to use/access the created macro named “\pax” (This code works, but is there another method provided by the expl3-package/LaTeX3 to use/access the macro without using \csname \endcsname?)
}
\ExplSyntaxOff
\begin{document}
\test{pa}{1,2,3}
\end{document}
How can i name a pgfmath macro depending on an element of a comma separated list?
Edit 1: Again, thanks a lot for the answers.