[Tex/LaTex] Bad hierarchy given to \appendix by hyperref

appendicesbookmarkshyperref

Here is my problem: in this document, the appendix appears as a chapter inside "part two", but I would like it to appear after this part, as it is an appendix!

Everything is alright in the table of contents. I'm speaking about the bookmarks generated by hyperref and used by the PDF viewer (evince for me) to navigate. Those bookmarks don't appear in the PDF file, but in a navigating panel in the viewer. In those links at the left of the screen, "list" appears to be part of the "two", and I would like it to appear after "two".

I hope I'm clear.

Minimal working example:

\documentclass{book}
\usepackage{hyperref}
\begin{document}
\frontmatter
intro
\tableofcontents

\mainmatter
\part{one}
text
\chapter{one-one}
text
\part{two}
text
\chapter{two-one}
text

\appendix
\chapter{list}
list
\backmatter
biblio etc.
\end{document}

Best Answer

The relevant command is from bookmark package, called \bookmarksetup -- since the appendix chapters should be on the same level as the parts, it's necessary to restart the next bookmark level again, using \bookmarksetup{startatroot}

The bookmark package extends the hyperref bookmarking facilities and it does the whole bookmarking in one run, not in at least two runs as usual for most LaTeX compilation.

\documentclass{book}
\usepackage{hyperref}
\usepackage{bookmark}
\begin{document}
\frontmatter
intro
\tableofcontents

\mainmatter
\part{one}
text
\chapter{one-one}
text
\part{two}
text
\chapter{two-one}
text

\bookmarksetup{startatroot}
\appendix
\chapter{list}
list
\backmatter
biblio etc.
\end{document}

enter image description here