目录条目和版权页的 PDF 书签不匹配

目录条目和版权页的 PDF 书签不匹配

memoir我在课堂上使用编写了一本书xelatex,但在使目录条目和 PDF 书签匹配时遇到了问题。而且,两者都指向错误的页面。这是我的 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}

我希望版权页在目录和 PDF 书签层次结构中与章节处于同一级别。

有人可以帮忙吗?

答案1

你需要\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不需要,因为级别由\addcontentsline

相关内容