【问题标题】:Delete **Contents:** in index of pdf generated with python-spihnx在使用 python-sphinx 生成的 pdf 索引中删除 **Contents:**
【发布时间】:2016-01-21 11:30:50
【问题描述】:

我有一个使用python-sphinx 创建的项目,我使用latexpdf 编译最终的pdf。

在创建的最终 pdf 中,在 index 中可以看到我想删除的 Contents: 字符串。

我现在找到的唯一方法是只编译latex,打开.tex 文件,查找字符串并从那里删除。

然后通过latexmake all-pdf编译pdf。

有没有办法指定?

【问题讨论】:

  • 这是 pythyn/sphinx 相关的,所以我认为在 SO 有这个问题是可以的,但也可以看看 tex.stackexchange 的 texperts 是否可以帮助你。

标签: latex python-sphinx pdflatex


【解决方案1】:

我的假设是您将 **Contents** 作为正常 .rst 标记的一部分,并将其用作目录 (ToC) 之前的标题,这在您的 html 中很好。

然而,对于 LaTeX,一个 ToC 被组装(如果有多个)并用作文档开头的唯一一个 ToC。 ToC 不会内联显示。这就是为什么您的 ToC 会显示在您的 **Contents** 标记之前

解决这个问题,您可以使用 Spinx 的.. only:: directive

.. only:: html

     **Contents**

或者要以正确的方式做事,您可以使用toctree directive:caption: 选项:

.. toctree::
   :caption: Contents

   your-content
   here

【讨论】:

    猜你喜欢
    • 2011-07-22
    • 1970-01-01
    • 2016-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多