Gyori Sandor gyori at szit.bme.hu
Tue Jul 29 19:25:29 CEST 2003

Dear TeXperts,

I have found a strange problem in TeX, but I am not sure whether

Originally, I wanted to put the following line in LaTeX:
\paragraph{blabla $\notin$ blabla}
and I got an error message:
! Illegal parameter number in definition of \reserved at a.
\crcr

This error message doesn't depend on documentclass or type of
section (paragraph, section, subsection,...). The important thing
is just \notin (which is a standard TeX command, see plain.tex
for its definition, and gives a bit nicer output than \not\in)
appears in the title of a paragraph.

Definition of \notin uses macro \c at ncel which uses through some
calling of other macros (\ooalign, \oalign, \ialign) the TeX
primitive function \halign. \halign doesn't "like" some situation
or environment and the question is, why?

LaTeX's sectioning commands are complex, there are lots of macros
calling each other. Simplifying this, I've expanded them,
substituted them into each other and deleted the unnecessary
commands. Finally, I've got a tiny, plain TeX example which
also gives error message:

\def\svsechd{%
\def\reserved{\halign{##\crcr a\crcr}}%
\reserved
}

\svsechd

and the error message is the same as above:

! Illegal parameter number in definition of \reserved.
\crcr
\svsechd ...f \reserved {\halign {##\crcr
a\crcr }}\reserved
l.7 \svsechd

I know that my example is unnatural and it could be simplified,
but LaTeX macros contain this structure. It is interesting,
if I write just the inner definition like this:
\def\reserved{\halign{##\crcr a\crcr}}%
\reserved
I don't get error message, in spite of the two code fragments
are logically the same, so they should behave the same. Outputs
are the same (simply, a letter 'a') in both cases, so there is
proper output also in the erroneous case.

The situation is the same in MikTeX & Windows and in teTeX & Unix.

Do anybody has an idea? I am not on the list, so please send me