[Tex/LaTex] Change bookmark depth

bookmarks

I want all bookmarks after "Anhang" (appendix) to be a level deeper, but I need them to be \chapter{} for the right numbering.

I write a scrbook document and that's what I got:

Issue

Is it possible to change the depth of the chapter to act like a section in the bookmarks?

UPDATE

MWE:

\documentclass[12pt,a4paper,oneside]{scrbook}

\usepackage[ngerman]{babel}     % deutsche Worttrennung
\usepackage[T1]{fontenc}        % Ausgabe von Sonderzeichen und Akzenten in PDF verbessert
\usepackage[utf8]{inputenc}         % Eingabe von Sonderzeichen möglich
\usepackage{lipsum}

\setcounter{secnumdepth}{3}     % subsubsections nummerieren
\setcounter{tocdepth}{3}        % subsubsections in TOC

\usepackage[ %
    pdfproducer={Texmaker},     % 
    pdfcreator={pdfLaTeX},      % 
    hidelinks,          % versteckt die Boxen um die Links in der PDF
    bookmarksnumbered,      % nummereiert Lesezeichen
    ]{hyperref}         % PDF Metainformationen hinzufügen 

\begin{document}

\appendix
\pagenumbering{alph}

\thispagestyle{empty}

\vspace*{3em}
\begin{center}
\begin{Huge}
\textbf{\textsf{Anhang}}
\pdfbookmark{Anhang}{Anhang}
\end{Huge}
\end{center}

\chapter{Appendix 1}

\chapter{Appendix 2}

\section{Appendix 2.1}

\section{Appendix 2.2}

\chapter{Appendix 3}

\end{document}

Best Answer

The easiest way is to redefine the \toclevel@.... commands, to shift the levels down. Use this only in the appendix.

Do not add any other \chapter etc. after the appendix!

\documentclass[12pt,a4paper,oneside]{scrbook}
\setuptoc{toc}{totoc}
\usepackage[ngerman]{babel}     % deutsche Worttrennung
\usepackage[T1]{fontenc}        % Ausgabe von Sonderzeichen und Akzenten in PDF verbessert
\usepackage[utf8]{inputenc}         % Eingabe von Sonderzeichen möglich
\usepackage{lipsum}

\setcounter{secnumdepth}{3}     % subsubsections nummerieren
\setcounter{tocdepth}{3}        % subsubsections in TOC

\usepackage[ %
    pdfproducer={Texmaker},     % 
    pdfcreator={pdfLaTeX},      % 
    hidelinks,          % versteckt die Boxen um die Links in der PDF
    bookmarksnumbered,      % nummereiert Lesezeichen
    bookmarksopenlevel=4,
    bookmarksopen=true,
    ]{hyperref}         % PDF Metainformationen hinzufügen 

\usepackage[]{bookmark}

\begin{document}

\chapter{Dummy}


\cleardoublepage
\pagenumbering{alph}
\chapter*{\appendixname}
\appendix%
\addcontentsline{toc}{chapter}{\appendixname}

\makeatletter
\renewcommand{\toclevel@chapter}{1}
\renewcommand{\toclevel@section}{2}
\renewcommand{\toclevel@subsection}{3}
\renewcommand{\toclevel@subsubsection}{4}
\renewcommand{\toclevel@paragraph}{5}
\renewcommand{\toclevel@subparagraph}{6}
\makeatother


\chapter{Appendix One}


\chapter{Appendix Two}

\section{SubAppendix One}

\section{SubAppendix Two}

\subsection{SubSubAppendix One}

\chapter{Appendix Three}%

\end{document}

enter image description here

Related Question