Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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

2 Answers 2

put a \cleardoublepage before every addcontentsline

share|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 –  Herbert Jul 19 '11 at 15:03

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.

share|improve this answer
    
It works! Thank you. –  LiN Jul 19 '11 at 17:30
    
+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 at 7:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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