General ⇒ Wrong page numbers in TOC
Wrong page numbers in TOC
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
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
-
- Site Moderator
- Posts: 814
- Joined: Tue Jul 01, 2008 2:19 pm
Re: Wrong page numbers in TOC
--
Joseph Wright
Re: Wrong page numbers in TOC
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
I have, of course, re-run everything several times.
Example:
Code: Select all
\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
Wrong page numbers in TOC
Code: Select all
\cleardoublepage
\addcontentsline{toc}{chapter}{Bibliography}
\bibliography{/Bib1}
\bibliographystyle{chicago.bst}
\cleardoublepage
\addcontentsline{toc}{chapter}{Index}
\printindex
Re: Wrong page numbers in TOC
I tried the second suggestion, and it worked PERFECTLY

Thanks!
Re: Wrong page numbers in TOC
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
just add \phantomsection before \addcontentsline:
Code: Select all
\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!