I have an existing command, defined within a \newenvironment:

\newcommand{\param}[3]{\textbf{##1} & \emph{##2} & ##3 \\ }

That command on its own works fine.

What I want to be able to do is to alias this command for typical use cases. The second argument to this command is a type, so I want something like:


However, this gives the error: Argument of \number has an extra }.

This error appears even if the \number command is never used.

What would the cause of this be?

  • 4
    The idea is fine per se, but \number is a TeX primitive, so redefining it is probably causing an issue with a place where the original version is expected. – Joseph Wright Jan 17 '13 at 6:23
  • Aha, that appears to be it. I realised that \number was an existing command, but I thought that if I redefined it within the \newenvironment, it wouldn't cause any problems (as the scope would be limited). It seems I was wrong on that! If you post that as an answer, I'll accept you. – sapi Jan 17 '13 at 6:29

As Joseph said, redefining \number is a bad idea, It's particularly self referential here as \newcommand (and \providecommand etc) all use \number to process the [2] optional argument that specifies how many arguments the command has. This normalises away any space and TeX constructs that expand to a number and exposes the literal digit that is needed to construct the #1#2 primitive TeX \def syntax.

\long \def \@yargdef #1#2#3{%
    \@yargd@f \expandafter{\number #3}#1%

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.