sphinx-doc / sphinx-doc/sphinx
The LaTeX builder doesn't handle multiple toctrees with captions well
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Problem
The HTML builder has good support for multiple separate toctrees with captions, like this:
.. toctree::
:caption: AAA
A1
A2
.. toctree::
:caption: BBB
B1
B2
In Alabaster it's rendered like this:
AAA
A1
A2
BBB
B1
B2
And in the RTD theme A1 and A2 are grouped in the table of contents:

The LaTeX builder, on the other hand, gets confused when presented with the same input:

Procedure to reproduce the problem
mkdir /tmp/sphinx-repro
cd /tmp/sphinx-repro
sphinx-quickstart --quiet --author x --project y
for i in {A,B}{1,2}; do printf "$i\n==" > "$i.rst"; done
cat > index.rst <<< '.. toctree::
:caption: AAA
A1
A2
.. toctree::
:caption: BBB
B1
B2
'
make latexpdf
Expected results
The table of contents should be split into two parts in LaTeX like in HTML
Environment info
- OS: GNU/Linux
- Python version: 3.5.2
- Sphinx version: 1.7.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 problem with the provided sphinx-quickstart and make latexpdf commands, then trace the LaTeX builder's handling of multiple captioned toctrees. Compare its output with the expected HTML-style split and add coverage for the two toctrees so completion can be verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- latex, python
- Domain
- build-system, documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100