6

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}
2
  • 1
    Differently from forums, we don't use to add “solved” to the title of the question.
    – egreg
    May 21, 2015 at 17:04
  • @Malo: If it is solved, please accept one of the two provided solutions then
    – user31729
    May 21, 2015 at 17:45

3 Answers 3

8

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

3

hyperref has a companion, bookmark, which disables hyperref's bookmarks and gives you some additional power. Include it and also include:

\bookmarksetup{startatroot}

just before your appendix. That will fix the issue.

3
  • You were quicker, but I provided the screenshot ;-) (+1)
    – user31729
    May 21, 2015 at 15:49
  • It is a fine screenshot, too. :-) May 21, 2015 at 15:49
  • Thank you, it worked well, end with this package I will maybe save some time, because the bookmarks now need only need one run instead of two !
    – Malo
    May 21, 2015 at 17:01
0

Piggybacking on @user31729's answer, I prefer using

 \bookmarksetupnext{level=part} 

before the appendices, so each of the "chapters" in the appendix gets to the next level in the bookmark. After that, just add

 \bookmarksetup{startatroot} 

before the bibliography.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .