2

I'm trying to compile a document, but when I launch pdflatex mydocument I get these output:

! Illegal parameter number in definition of \reserved@a
<to be read again>
l.14    \tableofcontents

Everything worked well as long as I kept all the document in the same source file. The error first raised when I divided the content in several .tex files and "recomposed" it with several \input{} commands. When I created the MWE I found out that the error is now being raised also when I put everything in the same source file:

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}

\usepackage[Glenn]{fncychap}
\usepackage{graphicx}
\usepackage{imakeidx}

\begin{document}
    \graphicspath{{images}}

    \setcounter{tocdepth}{0}
    \tableofcontents
    \setcounter{tocdepth}{1}
    \listoftables
    \listoffigures

    \part{Introduction}
    My input here...

    \mainmatter
    \part{Content}
    My input here...

    \appendix
    \part{Appendix}
    My input here...

\end{document}

I think that fncychap is involved in the problem because if I comment it out everything works well, but I can't understand where is the problem.

1
  • 1
    The simplest workaround is removing fncychap. Just avoid ugliness.
    – egreg
    Sep 17, 2019 at 14:02

1 Answer 1

1

The minimal example is

\documentclass{book}
\usepackage[Glenn]{fncychap}

\begin{document}

\tableofcontents

\end{document}

and I checked it with TeX Live releases since 2012, always with errors.

Workaround:

\documentclass{book}
\usepackage[Glenn]{fncychap}

\makeatletter
\let\@mkboth\@gobbletwo
\makeatother

\begin{document}

\tableofcontents

\end{document}

Of course, the best workaround is avoiding fncychap altogether, for the styles it provides are typographically very disputable.

2
  • Thanks a lot! May you ask you to explain what those commands do? P.S.: at the moment I need fncychap, at least as long as I'll have time to find another way to do the same I'm using it for.
    – Ntakwetet
    Sep 17, 2019 at 18:28
  • @Ntakwetet For some reason due to how fncychap redefines \chapter, the fact that the implicit title passed to \chapter* and containing \@mkboth fails. I couldn't determine the reason, and I'm not going to go deeper into it, because I find the Glenn style ugly as all the others. The workaround makes \@mkboth into a noop.
    – egreg
    Sep 17, 2019 at 19:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .