Sphinx Multitoc Numbering

0.1.3 · active · verified Thu Apr 16

Sphinx Multitoc Numbering is a Sphinx extension designed to provide continuous section numbering across multiple table-of-contents (toctrees) within HTML output. It's particularly useful for projects like Jupyter Book that combine various documents into a cohesive structure, ensuring a unified numbering scheme. The current version is 0.1.3, released on March 15, 2021, and the project documentation indicates it is in an active development stage, though its release cadence is infrequent.

Common errors

Warnings

Install

Imports

Quickstart

To quickly enable `sphinx-multitoc-numbering`, first install it via pip. Then, add `sphinx_multitoc_numbering` to your `extensions` list in `conf.py`. Finally, ensure your `toctree` directives include the `:numbered:` option (for reStructuredText) or `numbered: true` (for Jupyter Book's `_toc.yml`) to activate section numbering. The extension will then ensure continuous numbering across documents linked in the toctree.

# conf.py
# ...
project = 'My Multi-Part Documentation'
copyright = '2024, Your Name'
extensions = [
    'sphinx.ext.autodoc',
    'sphinx_multitoc_numbering'
]
# ...

# index.rst (or your master document)
.. toctree::
   :maxdepth: 2
   :numbered:

   part1/chapter1
   part1/chapter2
   part2/chapter3


# part1/chapter1.rst
Part 1, Chapter 1 Title
=======================

Section 1.1
-----------

This is the first section of chapter 1.

Section 1.2
-----------

This is the second section of chapter 1.


# part2/chapter3.rst
Part 2, Chapter 3 Title
=======================

Section 3.1
-----------

This is the first section of chapter 3.

Section 3.2
-----------

This is the second section of chapter 3.

view raw JSON →