Memoir update: Illegal parameter number in definition of \reserved@a
This is a bug in memoir.cls
, which has code for emulating textcase.sty
when the latter package is not installed.
However, code such as
\IfFileExists{<filename>}{<code>}{\def\foo#1{#1}}
doesn't work and, as far as I can tell, never has. The code should be
\IfFileExists{textcase.sty}{%
\RequirePackage[overload]{textcase}\@tempswafalse
}{\@tempswatrue}
\if@tempswa
% resort to the
%%%% Nearly a carbon copy from textcase.dtx by David Carlisle
\def\@uclcnotmath#1#2#3#4{\begingroup
#1%
\def\({$}\let\)\(% $ for emacs :-)
\def\NoCaseChange##1{\noexpand\NoCaseChange{\noexpand##1}}%
\@nonchangecase\label
\@nonchangecase\ref
\@nonchangecase\ensuremath
\def\cite##1##{\toks@{\noexpand\cite##1}\@citex}%
\def\@citex##1{\NoCaseChange{\the\toks@{##1}}}%
\def\reserved@a##1##2{\let#2\reserved@a}%
\expandafter\reserved@a\@uclclist\reserved@b{\reserved@b\@gobble}%
\protected@edef\reserved@a{\endgroup
\noexpand\@skipmath#3#4$\valign$}%
\reserved@a}
\def\@nonchangecase#1{\def#1##1{\NoCaseChange{#1{##1}}}}
\let\NoCaseChange\@firstofone
\def\@skipmath#1#2$#3${%
\@skip@nonchangecase#1#2\NoCaseChange\valign
\ifx\valign#3%
\else
$#3$%
\expandafter\@skipmath\expandafter#1%
\fi}
\def\@skip@nonchangecase#1#2\NoCaseChange#3{%
#1{#2}%
\ifx\valign#3%
\else
#3%
\expandafter\@skip@nonchangecase\expandafter#1%
\fi}
\DeclareRobustCommand\MakeTextUppercase{%
\@uclcnotmath{\def\i{I}\def\j{J}}{##1##2}\uppercase}
\protected@edef\MakeTextUppercase#1{\MakeTextUppercase{#1}}
\DeclareRobustCommand\MakeTextLowercase{%
\@uclcnotmath{}{##2##1}\lowercase}
\protected@edef\MakeTextLowercase#1{\MakeTextLowercase{#1}}
%%%% End copy from textcase.dtx
\fi % end of \IfFileExists
so the code is not absorbed as an argument, but is only read if textcase.sty
doesn't exist on the local system.
A fixed version of memoir
(v3.7j) have been shipped to CTAN.
It now also includes a warning if you do not have the textcase package on your system.