摘要未插入目录

摘要未插入目录

我已经尝试了一段时间,但每次都会出现相同的错误消息。

!LaTeX 错误:出现错误 — — 可能缺少 \item。

我想要实现的只是将摘要作为目录的一部分插入。

 \documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage[margin=1in]{geometry}
\usepackage{lipsum}
\providecommand\phantomsection{}% for hyperref

\author{blah}
\title{Essay}

\setlength{\parindent}{0mm}
\setlength{\parskip}{3mm}

\renewenvironment{abstract}
 {\small
  \begin{center}
  \bfseries \large \abstractname \vspace{-.5em}\vspace{0pt}
  \end{center}
  \list{}{
    \setlength{\leftmargin}{.5cm}%
    \setlength{\rightmargin}{\leftmargin}%
  }%
  \item\relax}
 {\endlist}

\begin{document}

\begin{titlepage}
    \centering
    {\scshape\LARGE School \par} \vspace{0.4cm}
    {\scshape\Large Research Based Essay\par} \vspace{1.7cm}

    \noindent\rule{15cm}{0.4pt}
    {\huge\bfseries title blah blah \\\vspace{0.5cm}
        \Large How Will blah blah \par}
        \noindent\rule{15cm}{0.4pt} \vspace{2.7cm}

    {\LARGE\itshape Author Name f\par} \vspace{1.5cm}
    {\large Candidate Number: 0000\par} \vspace{0.01cm}
    {\large Centre Number: 0000\par} \vspace{0.01cm}
    {\large 0000 Words \par} \vfill
    supervised by\par
    ~Simoniel \textsc{Catherine} \vspace{0.5cm}

    {\large \today\par}
\end{titlepage}

\tableofcontents \thispagestyle{empty}
\clearpage
\setcounter{page}{1}

\begin{abstract} \addcontentsline{toc}{chapter}{abstract}
The blah blah blah (To be continued...)
\end{abstract}
%\phantomsection



\section{Introduction}
\lipsum[1]
\end{document}

答案1

您使用的article文档类不使用chapter标题。这就是导致错误的原因。因此,更改\addcontentsline{toc}{chapter}{abstract}\addcontentsline{toc}{section}{abstract}

此外,如果您想要大写字母 A 的“Abstract”,则使用\addcontentsline{toc}{section}{Abstract}

在此处输入图片描述

完整代码

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage[margin=1in]{geometry}
\usepackage{lipsum}
\providecommand\phantomsection{}% for hyperref

\author{blah}
\title{Essay}

\setlength{\parindent}{0mm}
\setlength{\parskip}{3mm}

\renewenvironment{abstract}
 {\small
  \begin{center}
  \bfseries \large \abstractname \vspace{-.5em}\vspace{0pt}
  \end{center}
  \list{}{
    \setlength{\leftmargin}{.5cm}%
    \setlength{\rightmargin}{\leftmargin}%
  }%
  \item\relax}
 {\endlist}

\begin{document}

\begin{titlepage}
    \centering
    {\scshape\LARGE School \par} \vspace{0.4cm}
    {\scshape\Large Research Based Essay\par} \vspace{1.7cm}

    \noindent\rule{15cm}{0.4pt}
    {\huge\bfseries title blah blah \\\vspace{0.5cm}
        \Large How Will blah blah \par}
        \noindent\rule{15cm}{0.4pt} \vspace{2.7cm}

    {\LARGE\itshape Author Name f\par} \vspace{1.5cm}
    {\large Candidate Number: 0000\par} \vspace{0.01cm}
    {\large Centre Number: 0000\par} \vspace{0.01cm}
    {\large 0000 Words \par} \vfill
    supervised by\par
    ~Simoniel \textsc{Catherine} \vspace{0.5cm}

    {\large \today\par}
\end{titlepage}

\tableofcontents \thispagestyle{empty}
\clearpage
\setcounter{page}{1}

\begin{abstract} \addcontentsline{toc}{section}{Abstract}
The blah blah blah (To be continued...)
\end{abstract}

%\phantomsection



\section{Introduction}
\lipsum[1]
\end{document}

相关内容