附录为不同章节

附录为不同章节

我使用Legrand Orange Book作为模板,但出于某种原因,附录的链接指向前面的章节。这是我的序言:

\documentclass[11pt,fleqn]{book} 
\usepackage[top=3cm,bottom=3cm,left=3.2cm,right=3.2cm,headsep=10pt,a4paper]{geometry}
\usepackage[svgnames]{xcolor}
\definecolor{ocre}{RGB}{243,102,25} highlighting throughout the book
\definecolor{mygray}{RGB}{243,243,244}

%========================================================================================
%   Font Settings
%========================================================================================

\usepackage{avant} 
\usepackage{mathptmx} 
\usepackage{microtype} 
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 

\usepackage{calc}

% Fonts
\usepackage{textcomp}

%========================================================================================
%   Bibliography
%========================================================================================

\usepackage[refsection=chapter,defernumbers=true,sorting=none,sortcites=true,autopunct=true,babel=hyphen,abbreviate=false,backend=biber]{biblatex}

\begin{document}

%========================================================================================
%   CHAPTERS
%========================================================================================

\include{Chapters/Chapter1}
\include{Chapters/Chapter2}
\include{Chapters/Chapter3}
\include{Chapters/AppendixA}
\include{Chapters/AppendixB}
\include{Chapters/AppendixC}

\end{document}

我想将附录分成不同的章节,所以我采用了上述方法。有人能告诉我为什么附录的超链接指向前面的章节吗?例如,当我单击中的附录 A 链接时ToC,它会带我到第 1 章。此外,在与此模板相关的结构文件中,我有:

\usepackage{hyperref}
\hypersetup{hidelinks,backref=true,pagebackref=true,hyperindex=true,colorlinks=false,breaklinks=true,urlcolor= ocre,bookmarks=true,bookmarksopen=false,pdftitle={Title},pdfauthor={Author}}

答案1

OP 的 MWE 无法编译(缺少一些%字符等、\include我们无法访问的文件等)

根本没有hyperref任何加载\tableofcontents

我只能猜测,但我认为原贴作者在附录章节开始前使用了\setcounter{chapter}{0}and ,而不是\renewcommand{\thechapter}{\Alph{chapter}}\appendix

这会产生混淆hyperref,并迫使重新做符号锚点chapter.1(对于现实Chapter 1Appendix A当时是相同的)

便宜的解决方案是提供\hypersetup{hypertexnames=false}——这应该是最后的手段。

更好的方法是为附录章节提供一个新的锚点名称,比如\renewcommand{\theHchapter}{appendixchapter.\arabic{chapter}} (the\theH...` 命令提供锚点!)

最好的方法是使用\appendix

\documentclass{book}


\usepackage{hyperref}

\begin{document}
\tableofcontents

\chapter{Foo}
\setcounter{chapter}{0}
\renewcommand{\thechapter}{\Alph{chapter}}
\renewcommand{\theHchapter}{appendixchapter\arabic{chapter}}
\chapter{Foo appendix}

%\include{Chapters/Chapter1}
%\include{Chapters/Chapter2}
%\include{Chapters/Chapter3}
%\include{Chapters/AppendixA}
%\include{Chapters/AppendixB}
%\include{Chapters/AppendixC}

\end{document}

相关内容