使用 \part 时超链接不正确。我该如何纠正?

使用 \part 时超链接不正确。我该如何纠正?

我使用了如何使用部分和章节拆分乳胶文档将我的书分成几部分和几章。但是,目录有指向第 1 部分第 n 章的链接,用于任何部分的第 n 章。

我以前\counterwithin* {chapter}{part}也遇到过这种情况。这是正确的解决方案吗?

答案1

hyperref需要唯一的锚点名称。锚点名称大多使用计数器值。为了支持非唯一的计数器值,包hyperref使用 counter 的配套形式,它不用于排版,而是用于锚点名称。因此您需要,例如:theHcounter

 \renewcommand*{\theHchapter}{\theHpart.\thechapter).

本软件包添加了对或的hyperref支持,但这仅在使用它们时才有效\@addtoreset\counterwithin hyperref已加载。

例子:

\documentclass{book}
\usepackage{chngcntr}
\usepackage{hyperref}

\counterwithin*{chapter}{part}

\begin{document}
\tableofcontents
\part{One}\label{part:one}
\chapter{First}\label{chapter:first}
\part{Two}\label{part:two}
\chapter{Second}\label{chapter:second}
\end{document}

相关内容