Table of contents
Table of Contents
LaTeX offers features to generate a table of contents, changing its title, list of figures and tables, captions. They can be modified to fit a specific style. This article explains how?
Creating Table of Contents
It can be done using a few simple commands. Chapters, sections and subsections are included in the table of contents. For adding entries manually, for example, if you want to add an unnumbered section, the command \addcontentsline is used.
\documentclass{article}
\usepackage[utf8]{inputenc}
\title{TABLE OF CONTENTS}
\author{User}
\begin{document}
\maketitle
\section{Indian Food Recipes}
\subsection{Northern Recipes}
\subsection{Southern Recipes}
\subsection{Eastern Recipes}
\subsection{Western Recipes}
\end{document}
We have used the section and subsection for the portraying the topic and subtopic. For it to work properly, the user must compile the code twice or more.
Output of the above code
Changing the Title
First, we give the initial title using \title{initial title} command and then it can be
altered using the command \renewcommand*\contentsname{new command} and hence changing the
default value. If you are using international
languages and for its support, you use the package babel, then the command for changing
the previous title to the new title shall be written in the braces of the command: \addto\captionsenglish{
}.
\documentclass{article}
\title{Sections}
\author{}
\date{ }
\renewcommand*\contentsname{Chapters}
\begin{document}
\maketitle
\tableofcontents
\section{Introduction}
\section{Second Section}
\end{document}
Output of the above code
Creating a list of Figures/Tables
Generating the list of figures or tables is done in the same way. The commands \listoffigures and \listoftables help a lot while generating a list of figures and list of tables respectively. After compiling the code below, the output that we get is given just beside it.
\documentclass{article}
\usepackage[utf8]{inputenc}
\title{List of Figures}
\author{User }
\date{}
\begin{document}
\begin{figure}
\caption{This is the first figure}
\caption{This is the second figure}
\end{figure}
\begin{table}[]
\caption{This is the first table}
\caption{This is the second table}
\end{table}
\begin{appendix}
\listoffigures
\listoftables
\end{appendix}
\end{document}
Output of the above code