「sphinx-quickstart」で作成されたバニラのスフィンクス プロジェクト (Sphinx 1.2b3.) があります。
4 つのヘッダー レベルを持つ基本的な page.rst を追加します。
index.rst で html toc の深さを制御できます。
.. toctree::
:maxdepth: 1
:numbered:
page
ドキュメントhttp://sphinx-doc.org/latest/markup/toctree.htmlに基づいて、次のように conf.py を調整します。
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
}
それから私は構築します:
$ make clean
$ make html
$ make latexpdf
html は予想どおりレベル 1 のみを表示しますが、pdf は 2 つの toc レベルを表示し続けます - スクリーンショット:
ヒントはありますか?
どうも
ペレ
解決
ジェイコブによって提供されました -> 単に必要なレベル num -1 と考えてください:
'preamble': '\setcounter{tocdepth}{0}'