如何将目录纳入目录

如何将目录纳入目录

我想知道如何将目录纳入目录中......

我有一个如何将其欺骗到目录中的示例 - 使用 \phantomsection - 但似乎当我有一个很长的文档时链接有点错误 - 即它链接到之前的几页.....

\phantomsection
\addcontentsline{toc}{chapter}{Contents}
\tableofcontents

例子:

\documentclass[12pt, a4paper, twoside]{book}
\usepackage[english]{babel}
\usepackage{amsfonts,dsfont}
\usepackage[final]{pdfpages}
\usepackage{hyperref} 

%----------------------------------------------------------------------------------
\begin{document}
\pagenumbering{roman} 
%----------------------------------------------------------------------------------

%----------------------------------------------------------------------------------
\thispagestyle{empty}
\begin{titlepage}
{\Large
\begin{center}
{\bf XXXXXXXXXXXXXXX}
\end{center}
}
\end{titlepage}
%----------------------------------------------------------------------------------

\phantomsection
\addcontentsline{toc}{chapter}{Contents}
\tableofcontents


\phantomsection
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures

\phantomsection
\addcontentsline{toc}{chapter}{List of Tables}
\listoftables

%----------------------------------------------------------------------------------

\newpage
\setcounter{page}{1}
\pagenumbering{arabic}

\chapter{XXXXX}
\label{chXXXXX}

\section{Introduction}\label{chXXXXX_Intro}
BLAH BLAH BLAH. 

%----------------------------------------------------------------------------------

%--------------------
\setboolean{@twoside}{false}
\end{document}

答案1

好的...Gonzalo Medina 的超快回答\评论

除了使用 \phantomsection \addcontentsline{toc}{chapter}{Contents},您还可以加载 tocbibind 包。 – Gonzalo Medina 3 分钟前


示例变为:

\documentclass[12pt, a4paper, twoside]{book}
\usepackage[english]{babel}
\usepackage{amsfonts,dsfont}
\usepackage[final]{pdfpages}
\usepackage{hyperref}

\usepackage{tocbibind}


%----------------------------------------------------------------------------------
\begin{document}
\pagenumbering{roman}
%----------------------------------------------------------------------------------

%----------------------------------------------------------------------------------
\thispagestyle{empty}
\begin{titlepage}
{\Large
\begin{center}
{\bf XXXXXXXXXXXXXXX}
\end{center}
}
\end{titlepage}
%----------------------------------------------------------------------------------

\tableofcontents
\listoffigures
\listoftables

%----------------------------------------------------------------------------------

\newpage
\setcounter{page}{1}
\pagenumbering{arabic}

\chapter{XXXXX}
\label{chXXXXX}

\section{Introduction}\label{chXXXXX_Intro}
BLAH BLAH BLAH.

%----------------------------------------------------------------------------------

%--------------------
\setboolean{@twoside}{false}
\end{document} 

答案2

如果您正在使用 KOMA 脚本类,那么建议对该tocbibind包进行以下操作:

\setuptoc{toc}{totoc}

相关内容