3

As suggested in answers to existing questions, it is possible to use tableofcontents* or \begin{KeepFromToc} in order to make the table of contents not contain an entry to itself.

However, when I use these commands to avoid the ToC self-reference, the table of contents also disappears from my PDF bookmarks. Is there a way I can add back the bookmark entry for the ToC without making it reference itself?

hugomg
  • 1,071

1 Answers1

2

Something like this?

Define a hypertarget first, being the \tableofcontents* position and add a \pdfbookmark for this then. The default bookmark level is 0, seems to be alright for a ToC.

\documentclass{memoir}
\usepackage[bookmarksopen=true,bookmarksopenlevel=2]{hyperref}
\usepackage{blindtext}

\setcounter{tocdepth}{2}
\begin{document}
\phantomsection
\pdfbookmark{\contentsname}{toctarget}
\hypertarget{toctarget}{\tableofcontents*}

\chapter{First chapter}
\blindtext[5]
\section{First section}
\blindtext[5]
\subsection{First subsection}
\blindtext[5]
\end{document}
hugomg
  • 1,071
  • I don't suspect strange characters in the \contentsname, so \texorpdfstring isn't needed, most likely. –  Mar 31 '16 at 00:44