How to insert table of content in the report using LaTeX

Hi everyone, welcome to my blog where I share some tips and tricks on using LaTeX, a powerful document preparation system. Today, I'm going to show you how to insert a table of content in your LaTeX document.

A table of content is a list of the sections and subsections of your document, along with their page numbers. It helps your readers to navigate your document and find the information they need. It also gives an overview of the structure and organization of your document.

To insert a table of content in LaTeX, you need to use two commands: \tableofcontents and \section. The \tableofcontents command tells LaTeX where to place the table of content in your document. Usually, you put it right after the \begin{document} command. The \section command tells LaTeX the title of each section of your document. You can also use \subsection and \subsubsection commands to create sub-levels of sections.

Here is an example of a LaTeX document with a table of content:


   \documentclass{article}
   \begin{document} 
    \tableofcontents
    \section{Introduction}
    This is the introduction section.
    \section{Methods}
    This is the methods section.
    \subsection{Data collection}
    This is the data collection subsection.
    \subsection{Data analysis}
    This is the data analysis subsection.
    \section{Results}
    This is the results section.
    \section{Discussion}
    This is the discussion section.
    \section{Conclusion}
    This is the conclusion section.
    \end{document}

When you compile this document, you will get something like this:

Table of Contents

1 Introduction .......................... 1
2 Methods ............................... 2
  2.1 Data collection ..................... 2
  2.2 Data analysis ....................... 3
3 Results ............................... 4
4 Discussion ............................ 5
5 Conclusion ............................ 6

As you can see, LaTeX automatically generates the page numbers and the indentation for the table of content. You can also customize the appearance and style of the table of content using various packages and options. For more details, you can check out this link: https://www.overleaf.com/learn/latex/Table_of_contents

I hope you found this blog post helpful and learned something new about LaTeX. If you have any questions or comments, feel free to leave them below. Thanks for reading and happy LaTeXing!

Comments

Post a Comment

Please dont forget to tell me if this post helped you or not...

Popular posts from this blog

Changing caption width in latex

Subtitle in latex

Send in Email in Background in Thunderbird