2

Writing my master's thesis and changed how I define the sections from

\section*{\centering sectionname}
\addcontentsline{toc}{section}{sectionname}

to simply

section{sectionname}

This was done after feedback that I should number my sections.

The problem is that whenever I try to compile my document I get an error stating that the compilation timed out (using sharelatex.com free user, so the timeout occurs after 60 seconds). The thing is that if I just comment out \tableofcontents the whole document compiles in about 20 seconds without any problems. The only other changes I did to the document which I can think of was to change the text in some of my sections, which shouldn't cause this problem at all. The only section commands I use now are \section{}, \subsection{} and \subsubsection{}. I even tried to comment out a majority of my document and only compile a small part of it including \tableofcontents but I still get the same timeout message. Heads up is that I'm still very new to LaTeX.

Jagath
  • 4,287

1 Answers1

4

Your issue is due to the fact that LaTeX 'flounders' a bit* between the old entries in the table of content that do not exist anymore (\addcontentsline{toc}{section}{sectionname}), and the new ones that have the same name (generated by the \section{} macros).

The solution is thus to delete the auxiliary files to have a fresh start (actually, just the .aux one should be enough): at first compiling, LaTeX will identify the new keys but won't create the ToC since it has no previous informations about them. A second run will generate the ToC based on the actual \section{}s.

*I know there is a rational reason behind it, but I'm not skilled enough to know it (-;

ebosi
  • 11,692