Latex目录链接到错误的部分

Ver*_*gen 18 latex pdflatex texmaker

我有一个部分后跟一个目录,如下所示:

\section{Section1}
ABC.

\addcontentsline{toc}{section}{Table of Contents}
\tableofcontents
\newpage
\addcontentsline{toc}{section}{List of Figures}
\listoffigures
\newpage

\section{Section2}
DEF.
\section{Section3}
GHI.
Run Code Online (Sandbox Code Playgroud)

我的问题是目录中的"目录"和"数据列表"条目链接(在生成的pdf中)到文件中的错误位置.它们都链接到第1页的第一节部分.表中的条目是正确的(TOC表示第2页,LOF表示第3页),但链接转到了错误的位置.

Noa*_*oah 22

您需要使用以下\phantomsection命令:

\section{Section1}
ABC.
\phantomsection
\addcontentsline{toc}{section}{Table of Contents}
\tableofcontents
\newpage
\phantomsection
\addcontentsline{toc}{section}{List of Figures}
\listoffigures
\newpage

\section{Section2}
DEF.
\section{Section3}
GHI.
Run Code Online (Sandbox Code Playgroud)

请参阅hyperref手册.

  • 我建议了一种不同的解决方案,无论哪种方式都应该有效。 (2认同)