上面使用pdflatex-pdflatex编译会出现如下警告:
pdfTeX warning (ext4): destination with the same identifier (name{part.1}) has
been already used, duplicate ignored
<to be read again>
\relax
l.12 \part{first part}这意味着此时hyperref无法保证具有唯一的\thepart,而xelatex能正确处理「纯属巧合」
Claim: 下面的回答来自林间花@u38442 老师
此事在texdoc hyperref的sec13.7中亦有记载:
hyperref中\theHsection默认是\arabic{section},你如果只做\setcounter{section}{0}是不行的,你需要重定义一下\theHsection。下面是mwe:
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\tableofcontents
\section{apple}
\setcounter{section}{0}
\renewcommand{\theHsection}{\thesection.\thepage}
\section{banana}
\subsection{banana-tree}
\end{document}

























问 pdflatex编译下,自定义part计数器为什么导致hyperref生成的书签层级出错?