当使用notoccite
和 时hyperref
,我用 将页码改为罗马数字\pagenumbering
。目录中的页码是正确的,但 PDF 书签中的页码仍然是阿拉伯数字。此错误仅在使用 xelatex 编译时发生。pdflatex 和 lualatex 工作正常。
macOS 11.2.3
XeTeX 3.141592653-2.6-0.999993 (TeX Live 2021)
xdvipdfmx Version 20210318
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-02-18>
Package: notoccite 2000/07/20
Package: hyperref 2021-02-27 v7.00k Hypertext links for LaTeX
\documentclass{book}
\usepackage{notoccite}
\usepackage{hyperref}
\begin{document}
\pagenumbering{roman}
\tableofcontents
\newcommand\test{%
\chapter{Title}%
\section{Title}%
\subsection{Title}%
\subsection{Title}%
\subsection{Title}%
\section{Title}%
\subsection{Title}%
\subsection{Title}%
\subsection{Title}%
\section{Title}%
\subsection{Title}%
\subsection{Title}%
\subsection{Title}%
}
% Make sure the TOC has more than one page
\test
\test
\test
\end{document}
目录中的页码是正确的。
PDF 书签中的页码仍然是阿拉伯语。
答案1
hyperref 的代码设置页面标签测试\nofiles
,由于 nottoccite 将其设置为 false,因此它永远不会将所需的信息写入辅助文件。您可以覆盖命令:
\documentclass{book}
\usepackage{notoccite}
\usepackage{hyperref}
\makeatletter
\def\HyPL@StorePageLabel#1{%
\begingroup
\edef\Hy@tempa{\the\Hy@abspage<<#1>>}%
\immediate\write\@mainaux{%
\string\HyPL@Entry{\Hy@tempa}%
}%
\endgroup}
\makeatother
\begin{document}
\pagenumbering{roman}
\tableofcontents
\newcommand\test{%
\chapter{Title}%
\section{Title}%
\subsection{Title}%
\subsection{Title}%
\subsection{Title}%
\section{Title}%
\subsection{Title}%
\subsection{Title}%
\subsection{Title}%
\section{Title}%
\subsection{Title}%
\subsection{Title}%
\subsection{Title}%
}
% Make sure the TOC has more than one page
\test
\test
\test
\end{document}
使用当前补丁中的新 pdfmanagement 代码,pdfmanagement-testphase
无需此补丁。pagelabels 应该可以正常工作(代码更新于 2023-10)。
\DocumentMetadata{}
\documentclass{book}
\usepackage{notoccite}
\usepackage{hyperref}