[Tex/LaTex] PDF bookmarks for sections and subsections with the llncs class

bookmarkshyperreflncspdf

The following code is in the preamble of my LaTeX document:

\documentclass{llncs}
\usepackage{amsmath,amssymb}
\usepackage{url}
\usepackage[algoruled,vlined]{algorithm2e}
\usepackage{graphicx,subfigure}


\usepackage{hyperref} 
\hypersetup{colorlinks=true,citecolor=blue}


\numberwithin{equation}{section} % numbering according to the section
\bibliographystyle{plain}  %Choose a bibliograhpic style
\begin{document}

\title{The Title}
\maketitle
\section{A}
\label{sect:A}
\subsection{a}
\subsection{b}
% ...
\section{B}
\label{sect:B}
\subsection{a}
\subsection{b}
% ...
\section{C}
\label{sect:C}
\subsection{a}
\subsection{b}
% ...
\end{document}

Note that the text is organized into sections and subsection. However, after compiling the code, the Adobe PDF preview does not show the "tree" branching on the left. Instead, it just shows "The Title", and that option has no branching with the "+/-" sings. How could I achieve this?

Best Answer

The llncs class sets tocdepth to 0. This setting controls which sectioning commands end up in the Table-Of-Contents (TOC), which is also used by hyperref for the PDF bookmarks depth by default. You need to set the bookmarksdepth manually to a higher value (higher means more deeper sectioning commands are included). An alternative is to raise tocdepth again, but this also affects the \tableofcontents command, which might be unwanted.

Here are correctly working example:

\documentclass{llncs}
\usepackage[bookmarks,bookmarksopen,bookmarksdepth=2]{hyperref}
\title{The Title}
\author{the author}
%\setcounter{tocdepth}{2}%  alternative (2 or higher)
\begin{document}
\maketitle
\section{A}
\label{sect:A}
\subsection{a}
\subsection{b}
% ...
\section{B}
\label{sect:B}
\subsection{a}
\subsection{b}
% ...
\section{C}
\label{sect:C}
\subsection{a}
\subsection{b}
% ...
\end{document}

A list of all depth numbers for the sectioning commands can be found in How to show subsections and subsubsections in TOC?

Related Question