[Tex/LaTex] Abstract not being inserted into the Table of Contents

abstracterrorstable of contents

I have been trying for a while now but each time, the same error messages show up.

! LaTeX Error: Something's wrong–perhaps a missing \item.

What I'm trying to achieve is to merely insert the Abstract as a part of the table of contents.

 \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}

Best Answer

You're using the article document class, which doesn't use chapter headings. This is what is causing the error. Therefore, change \addcontentsline{toc}{chapter}{abstract} to \addcontentsline{toc}{section}{abstract}

Additionally, if you want 'Abstract' with a capital A. Then use \addcontentsline{toc}{section}{Abstract}

enter image description here

Full Code

\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}
Related Question