Open In App

How to Add a Table of Contents in the Jupyter Notebook

In this article, we will cover How to add a table of contents to the Jupyter Notebook. First, we look at what Jupyter Notebook and table of contents and why we use them, followed by a step-by-step tutorial to add a table of contents to the Jupyter Notebook.

Jupyter Notebook

The Jupyter Notebook is the original web application for creating and sharing computational documents that contain live code, equations, visualizations, and narrative text. It offers a simple, streamlined, document-centric experience. Jupyter has support for over 40 different programming languages and Python is one of them.



Add table of Contents in Jupyter Notebook

A Table of Contents is a structured list of chapters, and topics included in the book or a report. It is generally added at the beginning of the book or report to give an overview of its content, it helps the reader to seamlessly navigate within the document and helps to understand the organization or hierarchy of the content in the document.

To add a Table of Contents in the Jupyter Notebook will be a two-step procedure, first, we will add a table of contents in the Jupyter Notebook and in the second step we will link the chapters/topics mentioned in the table of contents to the actual content in the notebook.



Step 1: Add Table of Contents

Follow the below steps to add a Table of Contents in the notebook,

# Table of Contents
* [Chapter 1](#chapter1)
    * [Section 1.1](#section_1_1)
* [Chapter 2](#chapter2)
    * [Section 2.1](#section_2_1)
        * [Sub Section 2.1.1](#sub_section_2_1_1)
        * [Sub Section 2.1.2](#sub_section_2_1_2)
* [Chapter 3](#chapter3)
    * [Section 3.1](#section_3_1)
        * [Sub Section 3.1.1](#sub_section_3_1_1)
        * [Sub Section 3.1.2](#sub_section_3_1_2)
    * [Section 3.2](#section_3_2)
        * [Sub Section 3.2.1](#sub_section_3_2_1)

Step 2: Link the headings to content

## Chapter 1 <a class="anchor" id="chapter1"></a>
This is chapter 1
### Section 1.1 <a id="section_1_1"></a>
This is section 1.1
## Chapter 2 <a id="chapter2"></a>
This is chapter number 2
### Section 2.1 <a id="section_2_1"></a>
This is section 2.1
#### Section 2.1.1 <a id="sub_section_2_1_1"></a>
This is sub section 2.1.1
#### Section 2.1.2 <a id="sub_section_2_1_2"></a>
This is sub section 2.1.2
## Chapter 3 <a id="chapter3"></a>
This is chapter number 3
### Section 3.1 <a id="section_3_1"></a>
This is section 3.1
#### Section 3.1.1 <a id="sub_section_3_1_1"></a>
This is sub section 3.1.1
#### Section 3.1.2 <a id="sub_section_3_1_2"></a>
This is sub section 3.1.2
### Section 3.2 <a id="section_3_2"></a>
This is section 3.2
#### Section 3.2.1 <a id="sub_section_3_2_1"></a>
This is sub section 3.2.1

Conclusion

In this article we have covered what is table of content, how to implement it in the jupyter notebook using markdown and anchor in a detailed step-by-step tutorial along with the screenshots for better understanding.

Article Tags :