Creating a table of contents in LaTeX is much more elegant than in Word. There are only a few differences between the LaTeX document classes. You can have the table of contents generated automatically with one command. You can find out what you need to know for this and how it works in our tipps + tricks article.
How to create a table of contents in LaTeX
Step 1:
Format your LaTeX document as usual and import all required packages. Our basic structure is as follows:
\documentclass[12pt]{scrartcl}
\usepackage[ngerman]{babel}
\begin{document}
\end{document}
Step 2:
Enter the command \tableofcontents
at the beginning of the document to insert a table of contents at this point. Of course, you can also enter the command where you want the directory in your text.
\documentclass[12pt]{scrartcl}
\usepackage[ngerman]{babel}
\begin{document}
\tableofcontents
\end{document}
Step 3:
Of course, you now also need content for the directory. In the document classes book and report or scrbook and scrrprt , the command is used \chapter{}
for a heading. In the next heading level lies \section{}
. In the document class article or scrartcl , as used here, you also create the top heading level \section{}
. With you \subsection{}
create sub-headings and with you \subsubsection{}
create sub-sub-headings. If you also want to insert a fourth level for the signatures, this works with an additional command in the preamble:
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
You can then insert a fourth heading level subsubsection{}
for book and report or scrbook and scrrprt and \paragraph{}
for article or scrartcl. In the following we list again the exact formatting of the commands for the classes book and report or scrbook and scrrprt :
- \ chapter {heading}> Chapter 1
- \ section {subheading}> chapter 1.1
- \ subsection {sub-heading}> Chapter 1.1.1
- \ subsubsection {sub-sub-heading}> Chapter 1.1.1.1
Correspondingly, the formatting for the document class article or scrartcl follows:
- \ section {Heading}> Chapter 1
- \ subsection {subheading}> Chapter 1.1
- \ subsubsection {sub-subheading}> Chapter 1.1.1
- \ paragraph {sub-sub-heading}> Chapter 1.1.1.1
With these commands you can structure your LaTeX document up to the fourth heading level and create the table of contents. LaTeX does this automatically for you when creating the .pdf . New entries for your table of contents are always updated in the table of contents when you convert them again. An example of a document of the class scrartcl with the named headings looks like this:
\documentclass[12pt]{scrartcl}
\usepackage[ngerman]{babel}
\begin{document}
\tableofcontents
\newpage
\section{Einleitung}
Einleitender Text.
\subsection{Motivation}
Text.
\subsection{Kontext}
heise tipps + tricks.
\subsubsection{Hinweise}
Text.
\newpage
\section{Theoretische Grundlagen}
Text.
\end{document}