# Long table of contents makes page numbers wrong

I have created a table of contents page using `\tableofcontents` and I have enough chapters and sections that it fills an entire page and goes into another.

The problem is that since it takes a second page all of the page numbering is off by 1.

Is there a way that I can fix that?

-
Welcome to TeX.SX. On the first run the table of contents is not written; on the second run it is, but its appearance may offset the page numbers. On the third run all will be correct. –  egreg Dec 19 '11 at 17:30
I tried ScribTeX and it seems that adding `\usepackage{lastpage}` forces the process to do the required runs of LaTeX when the ToC occupies more than one page. Maybe it's better to put the reference to ScribTeX in the question. –  egreg Dec 23 '11 at 10:15

## 1 Answer

Creating a table of contents (ToC) needs at least two LaTeX runs: The first run to collect the data for the ToC and write it into an auxiliary file, the second run to actually typeset the ToC. In case the ToC itself takes more than one page, a third LaTeX run is needed (which will use the auxiliary data from the second run).

-
I have been using the website ScribTek (website) to generate my files. Does this mean to get this to work I will have to use something locally to get it to work correctly? (not opposed to it, just curious) –  Josh Pennington Dec 19 '11 at 17:37
@JoshPennington: Sorry, I don't know anything about ScribTek and how it determines if another LaTeX run is needed. –  lockstep Dec 19 '11 at 17:41
I am having this exact problem. My TOC is 6 pages long and the page numbering for all the sections is offset by exactly 6. I've tried running LaTeX two times and even three times, but it doesn't seem to make a difference. Any suggestions? –  Claudia LaFreniere Jun 15 '13 at 1:27
@Claudia: Does the ToC start on page 1 (say) and the first chapter on page 7? –  Werner Jun 15 '13 at 1:52