15

Since the link of TOC itself in TOC looks stupid,

enter image description here

\usepackage[nottoc]{tocbibind}  % no `Contents` in TOC

is used to remove it.

However, The Bookmark Contents will disappear in the index (on the left side).

and

\pdfbookmark{\contentsname}{toc}
\tableofcontents

seems solved this problem, BUT it points to the page before TOC.

So how to figure this out?

PS: book class is used in Texlive 2012.

1
  • 3
    Use \clearpage or \cleardoublepage before \pdfbookmark. Commented Feb 6, 2013 at 12:53

1 Answer 1

13

Just for the sake of closure...

As Ulrike Fischer mentioned in the comments, using \clearpage or \cleardoublepage before \pdfbookmark avoids the misinterpretation of the correct page.

The code should look like this:

\documentclass{article}


\usepackage{hyperref}
\usepackage[nottoc]{tocbibind}  % no `Contents` in TOC

\begin{document}
    \begin{titlepage}
        This is the title page
    \end{titlepage}

    \clearpage
    \pdfbookmark{\contentsname}{toc}
    \tableofcontents

    \newpage
    \section{a sample section}
        This is the beginning of a section

\end{document}

4
  • @doncherry sure, I'll edit the answer to include a MWE Commented Apr 10, 2013 at 7:53
  • Yes, it’s “community wiki”. When you start an answer or make an edit, then on the lower right you can activate this. (Older comment deleted.)
    – Speravir
    Commented Apr 10, 2013 at 16:19
  • This puts all pages after the toc under a [toc-name] tab. Is there a way to keep all content before toc, the toc and content after toc on the same level?
    – Me_Maikey
    Commented Aug 2, 2016 at 13:00
  • @Me_Maikey You can change the level by putting the level number in []: \phantomsection\pdfbookmark[1]{\contentsname}{contents} works for me.
    – cytrinox
    Commented Aug 13, 2016 at 22:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .