# Wrong PDF bookmark for Bibliography chapter

I cannot set up correct PDF bookmark for Bibliography chapter in the backmatter.

The page number in TOC is correct, however the PDF bookmark consistently points to the last section in the mainmatter.

\documentclass{book}

\usepackage{bookmark}

\begin{document}
\pdfbookmark{\contentsname}{Contents}
\tableofcontents\cleardoublepage
\pagenumbering{arabic}

\begin{mainmatter}
\chapter{Chapter A}
\section{Section a}
\end{mainmatter}

\begin{backmatter}
\begin{thebibliography}{9}
\end{thebibliography}
\end{backmatter}

\end{document}

• Change the order of \addcontentsline and \begin{thebibliography} – user31729 Jul 3 '14 at 13:12
• And it is sufficient to write \mainmatter and \backmatter, not \begin{mainmatter} etc. Those constructs are true commands and not environments – user31729 Jul 3 '14 at 13:14
• Changing the order of \addcontentsline and \begin{thebibliography} produces good PDF bookmark but wrong page number in TOC (last page of Bibliography). – Robert Jul 4 '14 at 9:58
• I used portions of your MWE and added another solution, however with \printbibliography instead of \begin{thebibliography}. At least in that short file the bookmarks and page numbers are correct – user31729 Jul 4 '14 at 16:19

Package tocbibind can be used to include the chapter titles of the table of contents and the bibliography to the table of contents and the bookmarks:

\documentclass{book}
\usepackage{tocbibind}
\usepackage{bookmark}

\begin{document}

\frontmatter
\tableofcontents

\mainmatter
\chapter{Chapter A}
\section{Section a}

\backmatter
\begin{thebibliography}{9}
\end{thebibliography}

\end{document}


Remarks:

• \mainmatter, \backmatter are commands rather than environments in class book.
• @Robert: That are different questions, e.g. see this answer. Also there are counter tocdepth and option depth of package bookmark (= option bookmarkdepth of hyperref). – Heiko Oberdiek Jul 4 '14 at 12:22

There is already a good answer by Heiko Oberdiek, I just wanted to react on the comment by the OP about the wrong page number. However, I use the biblatex package.

\documentclass{book}%

\usepackage[backend=biber]{biblatex}
\usepackage{bookmark}

% Normally biblio.bib is available on every TeXLive System in
% the sub-directory bibtex/msc
\bibliography{biblio}

\begin{document}
\pdfbookmark{\contentsname}{Contents}
\tableofcontents\cleardoublepage
\pagenumbering{arabic}

\mainmatter
\chapter{Chapter A}
\cite{Lam94} % Cite Leslie Lamport
\section{Section a}

\backmatter
\phantomsection
\printbibliography%

• You can just pass [heading=bibintoc] to \printbibliography`. See: tex.stackexchange.com/a/67155 – Rufflewind Dec 19 '17 at 6:40