0

Everything seems to be on the title.

Here is my MWE:

\documentclass{article}

\begin{document}

\tableofcontents

\section{Section 1}
Content of section 1.

\section{Section 2}
Content of section 2.

\addcontentsline{toc}{subsection}{Non indexed subsection}
Content of non indexed sub-section.

\section{Section 3}
Content of section 3.

\end{document}

The goal is pretty simple to explain: getting the “Non indexed subsection” printed in the TOC but not appearing in the PDF index when opened with a PDF reader.

How to get this behavior?

1 Answer 1

1

you can locally change the bookmarks depth to exclude some levels:

\documentclass{article}
\usepackage{hyperref}
\begin{document}

\tableofcontents

\section{Section 1}
Content of section 1.

\section{Section 2}
Content of section 2.

\hypersetup{bookmarksdepth=0}
\addcontentsline{toc}{subsection}{Non indexed subsection}
Content of non indexed sub-section.

\hypersetup{bookmarksdepth=3}
\section{Section 3}
Content of section 3.
\subsection{indexed}

\end{document}

enter image description here

You must log in to answer this question.

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