How to set depth depth of sphinx and latexpdf?

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 enter image description here :

Any clues?

THX

Pelle

Decision

was provided by jacob -> just think about the required num -1 level:

 'preamble': '\setcounter{tocdepth}{0}' 
+8
latex python-sphinx
source share
1 answer

The standard Sphinx Latin document class is based on the report class and uses chapters, so to display only chapter titles in the latex content table that you must set

 \setcounter{tocdepth}{0} 
+6
source share

All Articles