1

The following document typesets entirely and correctly unless I insert the command \tableofcontents in my Main.tex source file, which states "capacity exceeded error" without producing any PDF.

Here's an extract from the log file:

("C:\Users\Daniele\Documents\Tesi\File tesi LaTeX\Main.toc"
! TeX capacity exceeded, sorry [input stack size=5000].
\@let@token ...fvmode \else \aftergroup \maybe@ic 
                                                  \fi 
l.24 ...us\p@ \textnormal \shortcite {cM13f}}}{13}

If you really absolutely need more capacity,
you can ask a wizard to enlarge me.

And this is my main TeX file:

\documentclass[a4paper,twoside,openright]{book}

\usepackage{graphicx}
\usepackage{glossaries}
\usepackage{sectsty}
\usepackage{fancyhdr}
\usepackage{gensymb}
\usepackage{multirow}
\usepackage[apaciteclassic]{apacite}

\pagestyle{plain}

\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}

\makeatletter
\def\cleardoublepage{\clearpage\if@twoside
\ifodd\c@page
\else\hbox{}\thispagestyle{empty}\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother

\setacronymstyle{long-short}
\makeglossaries
\loadglsentries{Acronym}

\begin{document}

\input{Abstract}
\frontmatter
\tableofcontents
\printglossary

\mainmatter
\input{IntroFallot}
\input{Introduction2}
\input{Fallot}

\backmatter
\bibliographystyle{apacite}
\bibliography{Introduction1,Introduction2,Fallot}

\end{document}

I thought the problem might be related to the references that I had inserted into chapters and sections title, however nothing happens neither after removing this stuff and making plain titles. Does anyone have a solution before the ultimate step of adding it entirely manually?

Ok I've resolved, I removed the cmd \textnormal from the chapter title and now it works regularly. However I would need more help, can i avoid that commands inserted into the section or subsection titles (like \ or \cite) are automatically inserted into the table of contents?

1 Answer 1

2

This looks like a typical case of fragile command in moving argument.

Line 24 of Main.toc contains the entry for a section or some of its friends. Try to find it in the .tex file. The title for the section (or friend) contains a macro, which breaks, when moved to the table of contents. Add \protect before the macro, delete the .aux files and try again (two compile runs). If it works, the problem is solved, otherwise, post the problematic section title in form of a MWE if possible.

2
  • Ok Thank you I've at least understood the issue which actually regards cmds into sections and chapter titles. In fact, I've tried to compile the toc with clean titles after deleting .toc file and works fine, however I've to understand the exact problem into my sources since i've protected all cmds and it still doesn't work. Thank you Commented Aug 25, 2015 at 23:10
  • @danielelivorno You can edit your question to add the problematic section/chapter titles. Commented Aug 26, 2015 at 6:49

You must log in to answer this question.

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