2

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?

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}
  • I don't suspect strange characters in the \contentsname, so \texorpdfstring isn't needed, most likely. – user31729 Mar 31 '16 at 0:44

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.