3

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}

%\addappheadtotoc
\addcontentsline{toc}{part}{Appendices}
\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 '15 at 16:29
  • add a \clearpage before you want to start you appendix. – Johannes_B Jan 22 '15 at 16:33
4

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}{%
  \phantomsection\addcontentsline{toc}{part}{\appendixtocname}%
}

MWE

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

\renewcommand{\addappheadtotoc}{%
  \phantomsection\addcontentsline{toc}{part}{\appendixtocname}%
}

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

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

Output

enter image description here

and the bookmarks

enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.