Skip to content

RFE: Add mechanisms for customizing automatic section numbering #4133

@mwoehlke

Description

@mwoehlke

I'm working on a document (more particularly, I'm [ab]using sphinx to write a novel) that has rather particular requirements for section names:

  • Some sections should not be numbered.
  • Some sections are numbered, but must have specific (non-changing) text before the number.
  • Some sections should be numbered with Roman numerals.
  • Numbering should restart between groups of sections with different requirements.

Right now, Sphinx only supports the last item. I would like to see automatic section numbering improved to support these features.

In particular, my TOC looks like:

  • Foreword
  • Prologue
  • Chapter 1: Raining Cats and Dogs
  • Chapter 2: Other Silly Metaphors
  • ...
  • Appendix I: Etymology of Animal Names
  • Appendix II: Origins of Filler Text
  • Glossary

As chapter numbers are subject to change, I would really prefer to use automatic numbering rather than hard-coding everything into the actual headings. I can almost get there with Sphinx's current features; what I am missing is the ability to add prefix text to the section numbers (needs to be per toctree directive), and ability to choose the number style (likewise). The latter in particular seems like it really ought to be added as a feature, since someone might want to use other numbering styles depending on their language.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions