In beamer, I want to insert a bookmark level (or depth?) between part and section. In the example I called it chapter just like it is in the report class. My code put the part and chapter at the right level, but the sections are at the same level than chapter.
I have played around with commands from the bookmark package and some other things like \toclevel@section
but clearly, I don’t know what I’m doing and I can’t get the section level to change (except when I put \bookmarksetupnext{rellevel=1}
at the end of the chapter command, it works for the very next section only). How can I set the level of the section and subsection bookmarks to one level higher?
\documentclass{beamer}
\usepackage{bookmark}
\AtBeginPart{%
\frame{\partpage}
}%
\AtBeginSection[]{%
\frame{\sectionpage}
}%
\AtBeginSubsection[]{%
\frame{\subsectionpage}
}%
\newcounter{chapter}%
\setcounter{chapter}{0}%
\newcommand{\chapter}[1]{%
\hypertarget{chap\thechapter}{}
\bookmark[level=2, dest=chap\thechapter]{#1}{}
\refstepcounter{chapter}%
\begin{frame}
\begin{center}
{\large \textcolor{red}{Chapitre \thechapter \\ \ \\ #1}}%
\end{center}
\end{frame}
}%
\begin{document}
\part{First part}
\chapter{First chapter}
\section{First section}
\subsection{First subsection}
\section{Second section}
\chapter{Second chapter}
\section{Thrid section}
\part{Second part}
\chapter{Third chapter}
\section{Fourth section}
\section{Fifth section}
\end{document}