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...
By adding
\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}
Best Answer
\usepackage{icml2022}
has been loaded after\usepackage{hyperref}
, but as mentioned in https://tex.stackexchange.com/a/244889/128042:I deleted
\usepackage{hyperref}
and added it directly in the line after\usepackage{icml2022}
and now the bookmarks are shown correctly :)Is there any disadvantage of loading the packages in the correct order? Do you think ICML loads the packages on purpose in the wrong order? So far it seems to me that changing the order of the packages into the correct order only brought advantages over the code suggested by ICML 2022.