#
signs in command
definitions: in fact, the same rule holds, except that LaTeX
already takes care of some of the issues, by generating argument lists
for you.
The basic problem is that:
\newcommand{\abc}[1]{joy, oh #1!% \newcommand{\ghi}[1]{gloom, oh #1!}% }
followed by a call:
\cmdinvoke{abc}{joy}
typesets “joy, oh joy!”, but defines a command \
ghi
that takes
one parameter, which it ignores; \
ghi{gloom}
will expand to
“gloom, oh joy!”, which is presumably not what was expected.
\newcommand{\abc}[1]{joy, oh #1!% \newcommand{\ghi}[1]{gloom, oh ##1!}% }
does what is required, and \
ghi{gloom}
will expand to
“gloom, oh gloom!”, whatever the argument to \
abc
.
\newcommand{\abc}{joy, oh joy!% \newcommand{\ghi}[1]{gloom, oh ##1!}% }
is needed to produce a replica of the \
ghi
we defined earlier.
This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=ltxhash