Page LayoutWrong page numbers in Table of Contents

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
hlc304
Posts: 1
Joined: Wed Mar 21, 2012 2:57 pm

Wrong page numbers in Table of Contents

Post by hlc304 »

I had this problem with my thesis frontmatter/backmatter. The solution is to add new contents lines like this:

Code: Select all


\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{\protect\numberline{}List of Figures}
\listoffigures

\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{\protect\numberline{}List of Tables}
\listoftables
If you swap the order of the phantomsection and cleardoublepage lines, hyperrefs will point to the end of the previous section.
If you do the addcontentsline after the \listoftables commands, the contents line refers to the end of the section not the beginning.

This took me an entire morning of experimenting and googling to find out!
Hope this helps someone.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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

Post Reply