如何将摘要添加到目录中

如何将摘要添加到目录中

我认为将摘要添加到目录中是正确的,但我不知道该怎么做。这个答案谈论将摘要章节添加到目录中。我正在使用 Lyx,如果我输出到 .tex 文件,这就是我看到的内容。

\documentclass[english]{report}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{babel}

\makeatother

\usepackage{babel}
\begin{document}

\title{My Title}


\author{My Name}

\maketitle
\tableofcontents{}
\begin{abstract} %% This isn't a chapter!

我的摘要不是一个章节。


摘要创建于begin{abstract}与问题 I 不同的方式创建的链接并被标记为重复。在该示例中,摘要是一章。
这会影响将摘要放入目录的正确使用吗?


假设摘要和致谢内容使用 \chapter*{...} 排版,

事实并非如此,那么我该怎么办?

答案1

之内reportabstract环境是使用 设置的titlepage,默认将内容放在自己的页面上。因此,您必须使用一些修补程序插入 ToC 编写部分(通过以下方式支持etoolbox)。

在此处输入图片描述

\documentclass{report}
\usepackage[paper=a6paper]{geometry}% Just for this example
\usepackage{lipsum,etoolbox}% http://ctan.org/pkg/{lipsum,etoolbox}

% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\abstract}{\titlepage}{\titlepage% Insert ToC-writing after starting a titlepage
  \addcontentsline{toc}{chapter}{Abstract}}{}{}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

\begin{document}

\title{My Title}

\author{My Name}

\maketitle

\tableofcontents

\begin{abstract}
\lipsum[1]
\end{abstract}

\chapter{A chapter}

\end{document}

我将目录条目写成了chapter,这样格式看起来就一致了

\addcontentsline{toc}{chapter}{Abstract}

但是,您可以根据自己的喜好进行更改。


另一种方法是在环境中编写 ToC 条目abstract- 这可确保它与摘要位于同一页面上:

\begin{abstract}
  \addcontentsline{toc}{chapter}{Abstract}
  ...
\end{abstract}

答案2

由于摘要既不是章节也不是节,因此抽象的你应该使用

\开始{摘要}....\结束{摘要}

如下所示:

\begin{abstract}
\addcontentsline{toc}{chapter}{abstract}

abstract content here
\end{abstract}

下面这行用于显示内容列表中的摘要:

\addcontentsline{toc}{chapter}{abstract}

相关内容