Skip to content

Commit 07cc566

Browse files
committed
Doc: reset section count in each latex part
1 parent ca3de16 commit 07cc566

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

doc-source/latex_toctree_sections.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
__all__ = ["TocTreePlusDirective", "setup"]
1010

1111

12+
# TODO: The first section in a part has all sub sections nested under it in the sidebar,
13+
# The numbering is correct, and its correct in the contents
14+
1215
class TocTreePlusDirective(sphinx.directives.other.TocTree):
1316

1417
def run(self) -> List[nodes.Node]:
@@ -21,7 +24,9 @@ def run(self) -> List[nodes.Node]:
2124
and self.env.docname == self.env.config.master_doc
2225
):
2326

24-
latex_part_node = nodes.raw(text=f"\\part{{{caption}}}", format="latex")
27+
# TODO: \setcounter{section}{0}
28+
# https://tex.stackexchange.com/questions/271075/reset-counter-section-in-part
29+
latex_part_node = nodes.raw(text=f"\\setcounter{{section}}{{0}}\n\\part{{{caption}}}", format="latex")
2530
output.append(latex_part_node)
2631
# self.state.nested_parse(StringList(), self.content_offset, latex_part_node)
2732

0 commit comments

Comments
 (0)