0

I have the PDF set up so that the TOC and PDF bookmarks are generated.

However, I want to get rid of the Part "Front Matter" from the TOC (but not the sections under this part), while still generating the Part "Front Matter" in my PDF bookmarks. How can I do this?

Perhaps best explained by the screenshot of the PDF:

enter image description here

Code:

\documentclass{article}
\usepackage{tocloft}
\usepackage{bookmark}
\usepackage{refcount}
\bookmarksetup{numbered}

\begin{document}
\phantomsection \addcontentsline{toc}{part}{Front Matter}
\phantomsection \addcontentsline{toc}{section}{Cover}
Cover Art inserted here.

\phantomsection \addcontentsline{toc}{section}{Contents} \tableofcontents
\textbf{\LARGE{}About This Book}
\phantomsection \addcontentsline{toc}{section}{About This Book}

\part{The First Part}
\section{The First Chapter}
\end{document}
  • Did you mean \frontmatter? – AML Apr 24 '18 at 1:40
  • @AML: What do you mean? All I want to know is how to suppress particular Parts (or sections or subsections) from the TOC, without also suppressing them from the PDF bookmarks. – dtcm840 Apr 24 '18 at 2:26
  • I think this question could be relevant to you: tex.stackexchange.com/questions/123575/…. Also, you should try to get @HeikoOberdiek to help with this if possible, since he is the hyperref master. – AML Apr 24 '18 at 14:02
  • 1
    You can use \bookmark[level=part,dest=frontmatter]{Front Matter} and remove \phantomsection and \addcontentsline for front matter. – esdd Apr 24 '18 at 19:05
1

You can use \bookmark[level=part,dest=frontmatter]{Front Matter}:

\documentclass{article}
\usepackage{tocloft}
\usepackage{bookmark}
\usepackage{refcount}
\bookmarksetup{numbered}

\begin{document}
\bookmark[level=part,dest=frontmatter]{Front Matter}
\phantomsection \addcontentsline{toc}{section}{Cover}
Cover Art inserted here.

\clearpage
\phantomsection \addcontentsline{toc}{section}{Contents}
\tableofcontents
\setcounter{secnumdepth}{-2}
\section{About This Book}

\setcounter{secnumdepth}{3}
\part{The First Part}
\section{The First Chapter}
\end{document}

enter image description here

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.