I have a document in which I have a fairly deep hierarchy of /section
, /subsection
, /subsubsection
, /paragraph
, etc that I have been using to help organize the writing. For the final output, I only want headings for sections and subsections to appear in the printed output and table of contents, but I want to retain all headings in the PDF document outline.
I know how to suppress sections from the table of contents, using \setcounter{tocdepth}{2}
, however this also removes the headings from the PDF document outline, and doesn't suppress any headings.
For example:
\documentclass{article}
\usepackage[bookmarks]{hyperref} %pdf index
\usepackage{blindtext}
\setcounter{tocdepth}{2}
\begin{document}
\tableofcontents
\section{section}
\subsection{subsection}
\subsubsection{subsubsection}
\paragraph{paragraph}
\subparagraph{subparagraph}
\blindtext[1]
\end{document}
This outputs a document like this:
Contents
- section
- subsection
1. section
1.1 subsection
1.1.1 subsubsection
paragraph
subparagraph Lorem ipsum dolor ...
and the PDF document outline only contains section and subsection.
What I want is this:
Contents
- section
- subsection
1. section
1.1 subsection
Lorem ipsum dolor ...
but with a PDF document outline containing section, subsection, subsubsection, paragraph, and subparagraph.
bookmarks
, not thepdf index