GeneralWrong page numbers in TOC

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Judith
Posts: 7
Joined: Sun Oct 12, 2008 12:36 pm

Wrong page numbers in TOC

Post by Judith »

Hi,

I have a problem with the automatically generated Table of Contents. For the front matter and the mainmatter, everything works just fine. But the page numbers for all chapters in the backmatter (including an index and a bibtex bibliography) do not make sense. If I take out the index and the glossary, it works. Does anybody have an idea of how I could fix that?

Thanks,

Jduith

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: Wrong page numbers in TOC

Post by josephwright »

Are you running latex repeatedly and seeing no changes? Can you provide an example file or short example here where we can see what you are doing?
--
Joseph Wright
Joseph Wright
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Re: Wrong page numbers in TOC

Post by phi »

Hi,
what do you mean with "they do not make sense"? Please provide a minimal working example. Which document class do you use? Neither the standard classes nor the KOMA-Script classes nor the Memoir class change the page numbering for the back matter.
Judith
Posts: 7
Joined: Sun Oct 12, 2008 12:36 pm

Wrong page numbers in TOC

Post by Judith »

"Does not make sense" in the meaning of "are totally wrong". E.g. the nine page bibliography is listed as only having two pages, and those have the wrong numbers.

I have, of course, re-run everything several times.

Example:

Code: Select all

Code, edit and compile here:
\documentclass[11pt]{book}
\usepackage{makeidx}
\usepackage{chicago}
\setlength{\oddsidemargin}{3cm}
\setlength{\baselineskip}{0,5cm}
\setcounter{tocdepth}{2}
\setcounter{secnumdepth}{5}
\setlength{\baselineskip}{1.5em}
\setlength{\parindent}{0ex}
\makeindex
\begin{document}
\title{Title}
\author{Name}
\date{}
\maketitle
\frontmatter
\tableofcontents
\mainmatter
\chapter{Chapter title}
\citeNP{Labov2008}
\index{bla} \index{blubb}
\backmatter
\bibliography{/Bib1}
\bibliographystyle{chicago.bst}
\addcontentsline{toc}{chapter}{Bibliography}
\printindex
\addcontentsline{toc}{chapter}{Index}
\begin{appendix}
\chapter{Appendix chapter}
\end{appendix}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Page numbers of the index are incorrectly listed in the TOC


Thanks :-)
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Wrong page numbers in TOC

Post by phi »

I'm quite sure that the \addcontentsline commands create the problem. If you say \printindex\addcontentsline{toc}{chapter}{Index}, then the TOC entry refers to the page after the index. The easiest solution is to use a document class that allows adding TOC entries for bibliography and index, e.g., one of the KOMA-Script classes or memoir, or to use the tocbibind package. Some other points: The selection of the bibliography style should come before the inclusion of the bibliography; \appendix is a simple command, not an environment.
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Wrong page numbers in TOC

Post by Juanjo »

You may also try this:

Code: Select all

Code, edit and compile here:
\cleardoublepage
\addcontentsline{toc}{chapter}{Bibliography}
\bibliography{/Bib1}
\bibliographystyle{chicago.bst}
\cleardoublepage
\addcontentsline{toc}{chapter}{Index}
\printindex
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
Judith
Posts: 7
Joined: Sun Oct 12, 2008 12:36 pm

Re: Wrong page numbers in TOC

Post by Judith »

Thank you very much!

I tried the second suggestion, and it worked PERFECTLY :D

Thanks!
sonia_ppr
Posts: 2
Joined: Wed Nov 04, 2009 12:11 pm

Re: Wrong page numbers in TOC

Post by sonia_ppr »

Hi,

I have the same problem.
I applied the solution given here and it helped: pages numbers are correct in the table of contents.

BUT: I use the package hyperref to add links and the link generated in the table of contents for the bibliography takes me to the wrong place in the file (it takes me to the beginning of the previous section).

Can someone please help me with that??

Thanks,
Sonia
sonia_ppr
Posts: 2
Joined: Wed Nov 04, 2009 12:11 pm

Wrong page numbers in TOC

Post by sonia_ppr »

Never mind, found a solution on http://www.tug.org/applications/hyperref/manual.html:

just add \phantomsection before \addcontentsline:

Code: Select all

Code, edit and compile here:
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{\bibname}
\bibliographystyle{mystyle}
\bibliography{biblio}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Hope this helps someone :)

Sonia
chrono
Posts: 5
Joined: Thu Mar 31, 2011 6:55 pm

Wrong page numbers in TOC

Post by chrono »

sonia_ppr wrote:Hope this helps someone :)
It helped me :D

Thanks A LOT!
Post Reply