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.

This is a follow-up question to Gonzalo Medina's answer of Bibliography in table of contents. One of his solutions for including the bibliography in the ToC is to use the following code:

\documentclass{book}
\usepackage{etoolbox}

\apptocmd{\thebibliography}{\csname phantomsection\endcsname\addcontentsline{toc} {chapter}{\bibname}}{}{}

\begin{document}
\tableofcontents
\include{chapter1}
\bibliographystyle{plain}
\bibliography{biblio}
\end{document}

With hyperref, however, clicking on the ToC entry for the bibliography you end up at the first bib entry rather than at the title of the bib as it should be. How can this be solved?

PS: This is not a duplicate of \phantomsection - how to jump to the chapter title instead of the center of the page (only). I tried playing around with \cleardoublepage (as suggested in the answer to that question) but it didn't work for my problem.

share|improve this question

marked as duplicate by Stefan Kottwitz Mar 4 '13 at 8:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Actually my question IS almost a duplicate of tex.stackexchange.com/q/56521/16865 In my answer you can see why. Does anyone suggest that my question should either be closed or flagged as exact duplicate? @moderators: If so please feel free to do it! –  lpdbw Feb 24 '13 at 18:31

1 Answer 1

Inserting cleardoublepage between \csname and phantomsection solves the problem:

\documentclass{book}
\usepackage{etoolbox}

\apptocmd{\thebibliography}{\csname cleardoublepage phantomsection\endcsname\addcontentsline{toc} {chapter}{\bibname}}{}{}

\begin{document}
\tableofcontents
\include{chapter1}
\bibliographystyle{plain}
\bibliography{biblio}
\end{document}
share|improve this answer

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