TOC entry and PDF bookmark for colophon do not match

I am compiling a book in memoir class using xelatex and am having problems getting the TOC entry and PDF bookmark to match. Moreover, both point to the wrong page. Here is my MWE:

\documentclass[12pt]{memoir}
\usepackage[bookmarksopen=true]{hyperref}
\usepackage{bookmark}
\begin{document}
\frontmatter
\tableofcontents
%
\mainmatter
\chapter{One}
\section{Sample}
Here is some text.
\chapter{Two}
\section{Follow up}
Here is some more text.
\chapter{Three}
\section{More follow up}
Here is still more text.
\backmatter
\bookmarksetup{startatroot}
{\centering\Large\bfseries Colophon\\}
\noindent This is the start of the colophon.
\addcontentsline{toc}{chapter}{Colophon}
\end{document}


I wish the Colophon to be at the same level as a chapter in both the TOC and the PDF bookmark hierarchy.

Can someone please assist?

-

1 Answer

You need \phantomsection:

\documentclass{book}
\usepackage[bookmarksopen=true]{hyperref}
\usepackage{bookmark}
\begin{document}
\frontmatter

\tableofcontents

\mainmatter

\chapter{One}
\section{Sample}
Here is some text.
\chapter{Two}
\section{Follow up}
Here is some more text.
\chapter{Three}
\section{More follow up}
Here is still more text.

\backmatter

\phantomsection
\addcontentsline{toc}{chapter}{Colophon}%
{\centering\Large\bfseries Colophon\par}
\noindent This is the start of the colophon.
\end{document}


\bookmarksetup is not needed, because the level is set by \addcontentsline

-
Thank you @egreg. It works perfectly! I wonder why this very useful \phantomsection command is not more prominently documented. –  chandra Dec 21 '12 at 14:33
It is even mentioned in the memoir manual. Memoir uses it in several places even when hyperref is not used. –  daleif Dec 27 '12 at 12:54