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

\section*{\centering sectionname}

to simply


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.

  • Welcome to TeX.SX! You have changed to \section{section name} (with a backslash), right? Have you considered deleting all auxiliary files and compiling again? – ebosi Jun 27 '16 at 15:26
  • Deleting the auxiliary files and then recompiling solved the problem! Thank you very much! – Anders W Jun 27 '16 at 15:36

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 (-;

  • More explanations on how does the .aux file works can be found here – ebosi Jun 27 '16 at 16:35

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.