When I generate a .pdf
file from a .tex
file using pdflatex
, only the "Contents" title is shown with no actual TOC. If I run pdflatex my.tex
once more, it generates the TOC just fine. I can reproduce this simply by removing the .toc
file. What I think is happening is that my .toc
file is being generated too late -- so how can I make the TOC work first time? Should I be generating the TOC beforehand without using pdflatex
?

- 38,276
- 70
- 174
- 242
-
you could also use latexmk, which shoul do sthg. equivalent to rubber – epsilonhalbe Mar 03 '12 at 13:10
3 Answers
This is normal. LaTeX document need several compilations to reach a stable state. Use rubber -d my
to compile the right number of times (rubber comes as a package on many linux distros).

- 76,634
- 23
- 210
- 236
-
8Damn, I use Windows -- no rubber for me. Searching for "rubber windows" gave me some rather strange results :| – Nick Bolton Oct 05 '10 at 13:00
-
1It's funny to think of that as 'this is normal' ... ingenuously would have expected any good 'tex -> pdf' tool to do the two-pass as part of its internal processing ... Anyway you saved my life and rubber does the job so thanks a lot! – CitizenInsane Aug 13 '13 at 16:23
-
rubber is straight forward and simple to use. recommend rubber over pdflatex for generating pdf – Kuldeep Dhaka Aug 22 '15 at 19:28
-
Repeatedly beat the screen until picture returns. This is the standard solution from the 60s. – Dávid Horváth May 03 '20 at 05:26
I might be mistaken, but I think, that this is the default behaviour. I assume, you also won't find correct cross references (footnotes, end notes, literature) after the first run of pdflatex.
The point is, that LaTeX needs the extra rounds to resolve the references pointing inside the document, to get numbering and page numbers right.

- 81,211
- 44
- 156
- 212
I experienced the same problem with the editor Latexian. What solved the problem was changing the preferences. I changed "Number of typesetter runs at end" to 3, instead of the default 1. Then I added the "Refresh" button to the toolbar and tried refreshing and it worked.

- 21
- 1