4

In my thesis, I'm using the book class as such:

\documentclass[a4paper,12pt,twoside,openright]{book}
\usepackage[bookmarks=true,
    bookmarksopen,
    bookmarksopenlevel=1,
    colorlinks=true,
    pagebackref
]{hyperref}
\frontmatter
\begin{titlepage}
%\input{tex/universitytitlepage.tex}
\end{titlepage}

\pdfbookmark[0]{Table of Contents}{sumario_label}\tableofcontents

\mainmatter
\openright
%\include{tex/stuff}
\end{document}

But the "Table of contents" bookmark in the PDF points to the blank page after the titlepage instead ofthe TOC page.

Any idea on how to make it point to the start of the TOC page, not the page before it?

5

This can be solved by adding \cleardoublepage before the \pdfbookmark command, like so:

\cleardoublepage
\pdfbookmark[0]{Table of Contents}{sumario_label}\tableofcontents

There is no need for \phantomsection in this case, AFAIK.

I could not find the exact problem I had because questions such as Hyperref pointing is incorrect in the Table of Contents and How to add the pdf-bookmark of TOC without its name "Contents" in TOC do not explicitly mention the problem of \pdfbookmark pointing to the page before the TOC. So I used the advice on the answers to those questions to make this one.

  • 1
    \tableofcontents issues a page break command, after the bookmark has been set. If the page is still empty, however, this page break command has no effect and so a \cleardoublepage before setting the bookmark does the job. – egreg Sep 19 '13 at 10:05

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.