4

Why is this breaking?

MWE

\documentclass{memoir}
\begin{document}
test
\end{document}

Log

This is LuaTeX, Version 1.11.2 (TeX Live 2020/dev)
 restricted system commands enabled.
(./test.tex
LaTeX2e <2019-10-01> patch level 3

luaotfload | main : initialization completed in 0.123 seconds
(/opt/texlive/2019/texmf-dist/tex/latex/memoir/memoir.cls
Document Class: memoir 2019/11/15 v3.7i configurable book, report, article docu
ment class
(/opt/texlive/2019/texmf-dist/tex/generic/iftex/iftex.sty)
(/opt/texlive/2019/texmf-dist/tex/latex/memoir/mem10.clo)
(/opt/texlive/2019/texmf-dist/tex/latex/tools/array.sty)
(/opt/texlive/2019/texmf-dist/tex/latex/tools/dcolumn.sty)
(/opt/texlive/2019/texmf-dist/tex/latex/tools/delarray.sty)
(/opt/texlive/2019/texmf-dist/tex/latex/tools/tabularx.sty)
! Illegal parameter number in definition of \reserved@a.
<to be read again>
1
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
2
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
3
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
4
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
1
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
2
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
3
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
4
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
1
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
1
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
1
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
1
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
2
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
3
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
1
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
2
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
3
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
3
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
1
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
1
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
2
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
3
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
1
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
2
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
3
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
3
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
1
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
1
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
1
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
1
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \reserved@a.
<to be read again>
1
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \@uclcnotmath.
<to be read again>
{
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \MakeTextUppercase .
<to be read again>
1
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \MakeTextUppercase .
<to be read again>
2
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \MakeTextLowercase .
<to be read again>
2
l.12970 }
        % end of \IfFileExists
?
! Illegal parameter number in definition of \MakeTextLowercase .
<to be read again>
1
l.12970 }
        % end of \IfFileExists
?
)
No file test.aux.
[1{/opt/texlive/2019/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux)
)
 1054 words of node memory still in use:
   2 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 5 attribute, 178 glue_spe
c, 5 attribute_list, 2 write nodes
   avail lists: 2:75,3:7,4:1,5:40,6:7,7:51,9:51
</opt/texlive/2019/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf>
Output written on test.pdf (1 page, 2862 bytes).
Transcript written on test.log.
4

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.

  • The package textcase was missing from my system. Installing it fixed the immediate problems. – svenper Nov 21 at 6:11
6

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.

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.