9

「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}'
4

1 に答える 1

8

デフォルトの Sphinx latex ドキュメント クラスは report クラスに基づいており、チャプターを使用しているため、latex 目次にチャプター名のみを表示するには、設定する必要があります

\setcounter{tocdepth}{0} 
于 2013-11-19T20:03:49.300 に答える