In my sphinx documentation, I have some minor pages that (of course) need to be part of the toctree, but I can't get them listed in the right place.
If my "section 3" page looks like so:
.. toctree::
3.3
3.4
3
=====
3.1
-----
3.2
---
Then 3.3
and 3.4
are listed before 3
.
I've tried other permutations, but none seem to work.
- If I put the toctree after the
3
heading then3.3
and3.4
are listed between3
and3.1
. - If I put the toctree at the end of the page, everything is in the right order, but
3.3
and3.4
become third-level sections, children of section3.2
.
I've put up a concrete example, here:
To get the general structure right, you can user the include directive as follows:
Still, there is no good way to have these sections listed in a toctree on the same page. Listing
self
in the toctree will only show the first level heading and a direct self-reference - in your example tofurther-detail-1
- will work for html (although it will cause a warning), but mess up thelatexpdf
build.As a workaround, you could simply hard-code your own toctree using a list of references.