I would like to use some macros as arguments with xparse. I need it because I use siunitx.
Here is a simplified code which compiles:
\documentclass[a4paper]{article}
\usepackage{xparse}
\usepackage{siunitx}
\ExplSyntaxOn
\NewDocumentCommand{\onemacro}{m}{
Length~is~ \qty{8}{#1}.
}
\NewDocumentCommand{\multiplemacro}{m}{
\clist_new:N \l_my_clist
\clist_set:Nn \l_my_clist {#1}
first~length: \qty{5}{\clist_item:Nn \l_my_clist {1}} \par
second~length: \qty{8}{\clist_item:Nn \l_my_clist {2}}
}
\ExplSyntaxOff
\begin{document}
\onemacro{\candela}
\multiplemacro{cm,candela}
\end{document}
When I use a list with more than one argument, it only works if the arguments are not macros. As soon as I change to
\multiplemacro{\cm,\candela}
Here I have two macros as arguments, I get:
! Undefined control sequence.
\cm ->\ERROR
l.25 \multiplemacro{\cm,\candela}
How is it possible to pass more than one macro as arguments to another macro.
Or: how can I convert some strings to macros. For example: how to convert the string cm to the macro \cm for siunitx.

\exp_args:Nnx \qty{5}{\clist_item:Nn \l_my_clist {1}}. – user202729 May 03 '22 at 05:50