Illegal parameter number in definition

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

snippet.latex
\newcommand{\abc}{joy, oh #1!}

or (using TeX primitive definitions):

snippet.latex
\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: <!– {% raw %} –

>

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

<

!– {% endraw %} –

>

w

ill also produce this error, as will its TeX primitive equivalent: <!– {% raw %} –

>

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

<

!– {% endraw %} –

>

T

his 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

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

Creative Commons Lizenzvertrag Edit this page Old revisions Sitemap Backlinks RSS feed Impressum Flattr this