32

I have problem with table of contents and with bookmarks. In pdf file

  • table of contents shows wrong page number of Introduction and Bibliography,

  • Bookmarks: introduction and bibliography don't bring me to the correct page.

Part of my code

\documentclass[12pt,a4paper]{book}

\usepackage[polish]{babel}
\usepackage{polski}
\usepackage[cp1250]{inputenc}
\usepackage[pdftex,pagebackref=false,draft=false,pdfpagelabels=false,pdfstartview=FitH,pdfstartpage=1,bookmarks=true,pdfauthor={LiN},pdftitle={PD},pdfsubject={Titlei},pdfkeywords={words},unicode=true]{hyperref} 
\usepackage{tocloft}

\begin{document}
\tableofcontents
\addcontentsline{toc}{chapter}{Introduction}
\chapter*{Introduction}
\chapter{Chapter1}
\section{Section}
\addcontentsline{toc}{chapter}{Bibliography}
\begin{thebibliography}{9999999}%
\bibitem{1}Author, \emph{Title of book}, Publisher.
\end{thebibliography}
\end{document}

How can I change that?

  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count. This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). – N.N. Sep 21 '11 at 15:05
73

Put a \cleardoublepage before \addcontentsline. Also a \phantomsection is needed, since you are using hyperref:

\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{Introduction}
\chapter*{Introduction}

\clearpage gives a wrong result if the Table of Contents has an odd number of pages; \cleardoublepage avoids the problem altogether.

Another way is to put \addcontentsline after \chapter*{Introduction}; the same for the bibliography:

\begin{thebibliography}{9999999}
\phantomsection
\addcontentsline{toc}{chapter}{Bibliography}
\bibitem{1}Author, \emph{Title of book}, Publisher.
\end{thebibliography}

The method \cleardoublepage\phantomsection\addcontentsline must be used for the lists of figures and tables and for the bibliography if it's done with BibTeX.

| improve this answer | |
  • 4
    +1 for the \phantomsection which I never knew about, but works perfectly :) – Suresh Apr 16 '12 at 16:47
  • This is even a problem when using \secnumdepth to suppress numbering of something one wants in the toc. It goes in the toc just fine without an \addcontentsline, but the links will be all wrong. The best solution I've found for that problem is to \usepackage{etoolbox} \preto\section\phantomsection (or whichever sectioning macro is relevant) - this usually doesn't break stuff. – kahen Apr 26 '12 at 16:11
  • @egreg: I have tried this solution, but gives several problems, please take a look at: tex.stackexchange.com/questions/187744/… Thanks. – DavidC. Jul 3 '14 at 7:06
  • 2
    The References bookmark led to the wrong page for me. Solved the problem putting these two commands just above \bibliography{}. – marcelocra Sep 30 '15 at 6:14
  • +1 for the hint that \cleardoublepage goes before \addcontentsline. I am using the Thesis class from latextemplates.com/template/masters-doctoral-thesis and it works. – Grodon Mar 20 '16 at 16:08
2

put a \cleardoublepage before every addcontentsline

| improve this answer | |
  • It doesn't solve the problem. – LiN Jul 19 '11 at 14:58
  • sorry, should be \cleardoublepage for a two sided document – user2478 Jul 19 '11 at 15:03
  • \phantomsection is required as mentioned in egreg's answer. – nac001 Jul 29 '19 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.