I have a vanilla sphinx project (Sphinx 1.2b3.) created with "sphinx-quickstart"
I add a basic page.rst with 4 header levels.
I can control the depth of the html toc in index.rst:
.. toctree::
:maxdepth: 1
:numbered:
page
Based upon the documentation http://sphinx-doc.org/latest/markup/toctree.html I adjust the conf.py as follow:
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 build:
$ make clean
$ make html
$ make latexpdf
The html show only level 1 as expected but the pdf keeps showing 2 toc levels - screen shoot :
Any hints?
thx
pelle
solution
was provided by jacob -> simply think required level num -1:
'preamble': '\setcounter{tocdepth}{0}'