TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The issue that I am having is that the page numbers appearing in my TOC do not correspond with the actual pages on which the section/chapter is found. The problem occurs in the mainmatter, as well as in the backmatter. It gets progressively less accurate the further you go. At the end, it is off by about 20 pages. It starts getting things wrong from as early as page 11.

I have extensively searched online already before posting. Did find the following thread: http://www.latex-community.org/forum/viewtopic.php?f=5&t=3577, but I am not using the addcontentsline command anywhere (I removed it, just be sure).

A few sections are unnumbered (e.g.: \section*{Method}), but like I said, these are not added to the TOC with a addcontentsline command.

My code is the standard TOC, no options added:


Any help will be much appreciated.

share|improve this question

migrated from stackoverflow.com Jun 6 '11 at 13:18

This question came from our site for professional and enthusiast programmers.

closed as too localized by Caramdir, Alan Munn, lockstep, Gonzalo Medina, Stefan Kottwitz Aug 7 '11 at 22:54

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Please provide a compilable minimal example. And what is \tableofcontentssure, I do not know that command – daleif Jun 6 '11 at 13:27
How many times do you build your project? – ℝaphink Jun 6 '11 at 13:33
I don't know the tableofcontentssurecommand either. But I had that same problem until I figured it was caused by the first chapter, which was a starred one. So I added a \cleardoublepage\ phantomsection\addcontentsline{toc}{chapter}{<Chapter Name>} before the \chapter* command, and all is going well. – henrique Jun 6 '11 at 16:16
actually I have retested it (and reread your question --- I had not noticed you especifically mention \addcontentsline, sorry) and \phantomsection alone before a starred chapter (followed by 2 runs to build the TOC) corrects the page numbering in the TOC. – henrique Jun 6 '11 at 17:00
@henrique where are you using unnumbered chapters? Remember the use of \frontmatter in memoir, – daleif Jun 6 '11 at 18:18