# Getting hyperlinks, bookmarks, and TOC all right

I'm having trouble getting all three of the hyperlinks, PDF bookmarks, and the TOC "right". The following gives me the correct visual styling: Appendices appears in the TOC as a "part", before the actual appendix chapters. The hyperlink points to the wrong page, though (it's one or two pages too soon), and the PDF bookmarks for the Appendices are all placed inside the last chapter before the appendices.

\documentclass{book}
\usepackage{appendix}
\usepackage{hyperref}

\begin{document}
\tableofcontents
\part{One}
\chapter{One}

\part*{Appendices}
%\currentpdfbookmark{Appendices}{Appendices}
\phantomsection
\appendix

\chapter{First}

\end{document}


I tried several combinations and orders of the above, to no avail. Uncommenting the \currentpdfbookmark line gives me a double "Appendices" bookmark, one without any levels, and another one as it should be (the latter links to the page of the first appendix, which is not really optimal but I can live with it).

Any help is greatly appreciated. Or an alternative way to keep a "part-level" Appendix entry with the above requirements would be nice as well.

• \addcontentsline will always add the bookmark automatically unless redefined
– user31729
Jan 22, 2015 at 16:29
• add a \clearpage before you want to start you appendix. Jan 22, 2015 at 16:33

This can be avoided using the environment appendices instead of \appendix.

Load the appendix package with the options toc and page

\usepackage[toc,page]{appendix}


to have the ToC entry and the page with "Appendix".

Also redefine \addappheadtotoc if you want a part to be added to the ToC instead of a chapter.

\renewcommand{\addappheadtotoc}{%
}


MWE

\documentclass{book}
\usepackage[toc,page]{appendix}
\usepackage{hyperref}

}

\begin{document}
\tableofcontents
\part{One}
\chapter{One}

\begin{appendices}
\chapter{First}
\end{appendices}
\end{document}


Output

and the bookmarks

• Thanks, this gets everything right as far as I can tell. Jan 23, 2015 at 8:25
• @rubenvb Glad to help. Jan 23, 2015 at 8:26