[texhax] need a llittle help

Karl Berry karl at freefriends.org
Sat Jun 5 15:17:02 CEST 2004


    I was wondering if it possible to have a \newcommand whose name is made up
    of the argument of an outer \newcommand.

Sure, this is the basic reason for \csname.

\def\makecmd#1{\expandafter\def\csname#1\endcsname{body}}

\makecmd{foo} then defines \foo to expand to "body".

(If you like \newcommand then add appropriate syntactic sugar.)



More information about the texhax mailing list