sphinx-doc / sphinx-doc/sphinx
Figure numbers don't restart
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Figure numbering isn't restarted when encountering a new top-level toctree directive, even when :numbered: is set on the directives and numfig = True and numfig_secnum_depth = 1.
For example, with this index.rst:
.. toctree::
:hidden:
:caption: General
:numbered:
definitions
procedures
.. toctree::
:hidden:
:caption: User Manual
:numbered:
manual_section1
manual_section2
If there's a figure somewhere in/under definitions.rst or procedures.rst, figure numbering in the user manual will not start at 1.
I'm not sure this is a bug per sé, but it's something that I experienced as unexpected. It's hard to say what the correct behavior would be because it's not clear in general how multiple top-level toctree directives should be interpreted/represented (see #4733 and #4977, for example).
Environment info
- Python version: 3.6.9
- Sphinx version: 3.2.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the numbering behavior with the provided index.rst structure, numfig = True, and numfig_secnum_depth = 1. Read the discussion in issues #4733 and #4977 to understand how multiple top-level toctree directives are represented. Done requires an agreed expected behavior and regression coverage for figure numbering across the two toctrees.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100