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. When generating the code above, the output that comes out is given below.

Output of the code above


table-of-contents-output

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 code above


table-of-contents-output

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 code above


List-of-figures-output

Captions :

It is always a good practice to use a caption for any figure or table. We use the command \caption to give the figure or table a caption. There can be many types of captions.

Side captions are the captions used in the code so that the caption of the figure or table on the float, rather than above or below. The package sidecap is used to position the caption beside a figure or a table.

Unnumbered captions are used when the figure captions do not have to start necessarily with Figure. This case occurs usually in presentations. We can suppress the caption by placing the caption text in figure environment, without enclosing it in a caption. This would mean that there is no caption included in a list of the figure.


If you are finding Formatting document using LaTeX difficult, no worries, just send us your document and Get it formatted according guidlines.