# How do I create bookmarks with pdfLaTeX?

I'm using MiKTeX and using pdfLaTeX. I can generate the PDF, but there are no bookmarks. In the .tex-file it is using:

\chapter
\section
\subsection


(with labels)

I originally used make with sphinx to output LaTeX. It must work somewhat or I wouldn't get the PDF. When I say bookmarks, I mean when you are in Acrobat and the left side has the Bookmarks panel.

But I am not sure where to apply this.

EDIT: I applied this, \usepackage{bookmark}, and got bookmarks, but I never get the subsection bookmarks.

• \usepackage{hyperref} – Henri Menke Dec 30 '16 at 20:32
• \usepackage{bookmark} will also be helpful... – user31729 Dec 30 '16 at 20:32
• The depth of the bookmarks can be changed. Read the documentation of bookmark – Ulrike Fischer Dec 30 '16 at 20:40
• \usepackage[depth=subsection]{bookmark} will show the subsection bookmarks, the bookmark package 'translates' the relevant section level into the level number (which is 2 for subsection, so depth=2 would work too) – user31729 Dec 30 '16 at 20:49

By default, bookmarks replicate the table of contents. So if your ToC shows content up to \section, so will the bookmarks. The default level up to which content is shown in the ToC is 2 - equivalent to \subsection (in book and report). So, the following minimal example

\documentclass{book}

\usepackage{bookmark}

\begin{document}

\tableofcontents                % Level 0 (chapter)

\chapter{A chapter}             % Level 0
\section{A section}             % Level 1
\subsection{A subsection}       % Level 2
\subsubsection{A subsubsection} % Level 3
\paragraph{A paragraph}         % Level 4
\subparagraph{A subparagraph}   % Level 5

\end{document}


shows the bookmarks up to level 2:

If yours doesn't show up to this level, then you must be using a different class, or perhaps a package that sets a different level of inclusion. This can be changed though...

\setcounter{tocdepth}{3}% Show ToC content up to level 3 (\subsubsection)


to your preamble to ToC/bookmarks resemble

The above works the same with hyperref as it does with bookmark.

You can have different depths of visibility in the ToC and bookmarks. This is provided by the bookmarks option depth.

\documentclass{book}

\usepackage[depth=4]{bookmark}% Show up to level 4 (\paragraph) in bookmarks

\setcounter{tocdepth}{3}% Show up to level 3 (\subsubsection) in ToC

\begin{document}

\tableofcontents                % Level 0 (chapter)

\chapter{A chapter}             % Level 0
\section{A section}             % Level 1
\subsection{A subsection}       % Level 2
\subsubsection{A subsubsection} % Level 3
\paragraph{A paragraph}         % Level 4
\subparagraph{A subparagraph}   % Level 5

\end{document}