Welcome to the UK List of
TeX Frequently Asked Questions
on the Web

Searching

The index of Frequently Asked Questions about TeX is searchable.

Please enter your keyword here:   then press here: ,    or:
Google

Illegal parameter number in definition

The error message means what it says. In the simple case, you’ve attempted a definition like:

\newcommand{\abc}{joy, oh #1!}

or (using TeX primitive definitions):

\def\abc{joy, oh #1!}

In either of the above, the definition uses an argument, but the programmer did not tell (La)TeX, in advance, that she was going to. The fix is simple — \newcommand{\abc}[1], in the LaTeX case, \def\abc#1 in the basic TeX case.

The more complicated case is exemplified by the attempted definition:

\newcommand{\abc}{joy, oh joy!%
  \newcommand{\ghi}[1]{gloom, oh #1!}%
}

will also produce this error, as will its TeX primitive equivalent:

\def\abc{joy, oh joy!%
  \def\ghi#1{gloom, oh #1!}%
}

This is because special care is needed when defining one macro within the code of another macro. This is explained elsewhere, separately for LaTeX definitions and for TeX primitive definitions


Go to previous question, or next question

Go to FAQ home.

URL for this question: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=errparnum

Comments, suggestions, or error reports? - see “how to improve the FAQ”.

This is FAQ version 3.28, released on 2014-06-10.