[XeTeX] command argument as macro

Will Robertson wspr81 at gmail.com
Thu Oct 8 14:22:45 CEST 2009


On 2009-10-08 21:15:17 +1030, Michiel Kamermans 
<pomax at nihongoresources.com> said:

> \document{article}
> \newcommand{\coma}{1}
> \newcommand{\comb}{2}
> \newcommand{\comc}{3}
> \newcommand{\getnumber}[1]{ \#1 }
> \begin{document}
> \getnumber{coma}
> \end{document}

Your thinking is along the right track; the syntax to use is

    \newcommand{\getnumber}[1]{\csname #1\endcsname}

or

    \newcommand{\getnumber}[1]{\@nameuse{#1}}

if that's any easier to remember.

Hope this helps,
Will




More information about the XeTeX mailing list