General ⇒ Wrong page numbers in TOC
Wrong page numbers in TOC
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
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
-
- Site Moderator
- Posts: 814
- Joined: Tue Jul 01, 2008 2:19 pm
Re: Wrong page numbers in TOC
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
Joseph Wright
Re: Wrong page numbers in TOC
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.
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.
Wrong page numbers in TOC
"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:
Page numbers of the index are incorrectly listed in the TOC
Thanks
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}
Thanks

Wrong page numbers in TOC
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.
Wrong page numbers in TOC
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
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
Re: Wrong page numbers in TOC
Thank you very much!
I tried the second suggestion, and it worked PERFECTLY
Thanks!
I tried the second suggestion, and it worked PERFECTLY

Thanks!
Re: Wrong page numbers in TOC
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
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
Wrong page numbers in TOC
Never mind, found a solution on http://www.tug.org/applications/hyperref/manual.html:
just add \phantomsection before \addcontentsline:
Hope this helps someone 
Sonia
just add \phantomsection before \addcontentsline:
Code: Select all
Code, edit and compile here:
\cleardoublepage\phantomsection\addcontentsline{toc}{chapter}{\bibname}\bibliographystyle{mystyle}\bibliography{biblio}

Sonia
Wrong page numbers in TOC
It helped mesonia_ppr wrote:Hope this helps someone

Thanks A LOT!