Krischan Ledwig
Krischan Ledwig

Reputation: 171

Latex section without a number in the table of contents

I would like to create a table of contents for a bachelorthesis but dont wanna nummerate all points of it. The abstract for example should be in the toc but not with a number. I write my thesis in the documentclass article where i dont have the chance to use \chapter. Is there an easy way to fix the problem?

Thank you!

Upvotes: 15

Views: 43553

Answers (2)

Steinarr
Steinarr

Reputation: 176

Insired by the answer by Raida I made three new commands to accomplish the task for sections, subsections and subsubsections.


\documentclass{article}

% three custom commands to create an unnumbered (sub(sub))section 
% that still gets included in table of contents.

\newcommand{\usection}[1]{\section*{#1}
\addcontentsline{toc}{section}{\protect\numberline{}#1}}

\newcommand{\usubsection}[1]{\subsection*{#1}
\addcontentsline{toc}{subsection}{\protect\numberline{}#1}}

\newcommand{\usubsubsection}[1]{\subsubsection*{#1}
\addcontentsline{toc}{subsubsection}{\protect\numberline{}#1}}

\begin{document}
\tableofcontents

\usection{Abstract}

\usection{Introduction}
\usubsection{SubSection}
\usubsubsection{SubSubSection}

\section{Section 1}

\section{Section 2}

\usection{Conclusion}

\end{document}

Upvotes: 4

Raida
Raida

Reputation: 1502

You can use \section*{} which create a section without the numeration. However, it will not be present in the table of content. You can manually add it with \addcontentsline{toc}{section}{\protect\numberline{}Your section name}.

For example for an abstract, an introduction, two numbered sections, and a conclusion, you can do:

\documentclass{article}

\begin{document}
\tableofcontents

\section*{Abstract}
\addcontentsline{toc}{section}{\protect\numberline{}Abstract}

\section*{Introduction}
\addcontentsline{toc}{section}{\protect\numberline{}Introduction}

\section{Section 1}

\section{Section 2}

\section*{Conclusion}
\addcontentsline{toc}{section}{\protect\numberline{}Conclusion}

\end{document}

Upvotes: 33

Related Questions