2

I am trying to make a table of contents exactly as instructed on the tutorial, but it does not show up, even when I compile 2 times. The tutorial uses this code as an example:

\documentclass{article}

\begin{document}

\tableofcontents
\newpage

\section{Section}

Dummy text

\subsection{Subsection}

Dummy text

\end{document}

And it should output this: nd

But in my document after compiling twice, only the "Contents" header shows up on the first page and sections I added on the second page. enter image description here enter image description here

I also tried using the \addtocontents{toc} and \setcounter{tocdepth}{3} commands but they don't do anything. How do I make the contents appear, including the page numbers of each section as shown in the tutorial?

2
  • I clarified that this is happening after I compiled it twice. – Random Stuff Jun 26 '19 at 13:04
  • The MWE that you have provided worked well on my system. Which TeX-engine are you using? – Niranjan Jun 26 '19 at 13:05
1

I'll let LaTeX answer the question:

enter image description here

\documentclass{article}
\def\latexbase{\LaTeX base doesn't support table of contents}
\begin{document}
\latexbase
\makeatletter
  \immediate\write\@auxout
    {\gdef\noexpand\latexbase{\noexpand\LaTeX base supports table of contents}}
\makeatother
\end{document}

(as always, compile twice).


LaTeXbase doesn't seem to keep track of auxiliary files, such as the .toc for the Table of Contents, or even the .aux file. Plus, the log file there says:

This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010)

so for those who complain that Overleaf's TeXLive distribution is outdated (2017)...

The solution is to move to another platform (Overleaf, for example), or better, have a local installation.

2
  • Thank you. I just tried it in Overleaf and it worked. – Random Stuff Jun 26 '19 at 13:22
  • 2
    Note they are not using an off the shelf texlive distribution but compiling the tex sources to javascript and running it in a browser so they can perhaps be forgiven not for updating too often (aux files ought to work though....) – David Carlisle Jun 26 '19 at 13:48

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.