I have a vanilla sphinx project (Sphinx 1.2b3.) Created using "sphinx-quickstart"
I am adding a basic page.rst with 4 levels of headings.
I can control html toc depth in index.rst:
.. toctree:: :maxdepth: 1 :numbered: page
Based on the documentation http://sphinx-doc.org/latest/markup/toctree.html I configure conf.py as follows:
ADDITIONAL_PREAMBLE = """ \setcounter{tocdepth}{1} """ latex_elements = { # The paper size ('letterpaper' or 'a4paper'). 'papersize': 'a4paper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. 'preamble': '\setcounter{tocdepth}{1}' #'preamble': ADDITIONAL_PREAMBLE }
Then I create:
$ make clean $ make html $ make latexpdf
The html shows only level 1, as expected, but in pdf format 2 levels are saved - screen shielding
:
Any clues?
THX
Pelle
Decision
was provided by jacob -> just think about the required num -1 level:
'preamble': '\setcounter{tocdepth}{0}'
latex python-sphinx
pellekrogholt
source share