【问题标题】:How insert some space before and after images in Sphinx如何在 Sphinx 中的图像前后插入一些空格
【发布时间】:2013-07-26 13:36:54
【问题描述】:

我使用 make latexpdf 命令通过 Sphinx 创建了一个文档。

现在我遇到的问题是,LaTeX 将我的图片直接设置在文本之后的顶部,并在图像的底部放置 3 或 4 个换行符。

是否有可能在图片顶部获得 1 个空格,在图片底部获得 1 个空格? 必须在语法中使用\

我的代码:

title:
===========

some text

.. image:: screenshots/manage_products.png

some more text

another title:
===========

编辑:这里有一个小屏幕截图向您展示我的问题。我还查看了 Sphinx 的主要文档(+ 语法文档),但没有找到这个问题的答案!

顺便说一句:请忽略红色箭头。

【问题讨论】:

标签: latex line-breaks python-sphinx


【解决方案1】:

您可以使用 .. figure:: 指令在图像周围添加您想要的额外间距。

title:
===========

some text

.. figure:: screenshots/manage_products.png

some more text

我也更喜欢使用 figure 指令,因为您的图像有一些额外的控制元素,例如标签。

.. figure::

   Your figure text here

【讨论】:

  • 它工作正常,我不会再使用 .. image:: 命令了!
  • 我正在使用 make latexpdf 从我的 Sphinx 项目中生成 pdf 文件。但是我遇到了图像插入问题。您能在这里查看我的question 吗?
【解决方案2】:

想在图片后面加一条窄线,尝试了各种组合,要么都不管用,要么在图片后面加一条宽线。

最终创建了一个很小的 ​​empty.png 图像并插入到页面中:

.. image:: _static/main.png 
    :align: center
    :scale: 70 %    

.. image:: _static/empty.png 
.. empty.png image above to add space after main.png image

【讨论】:

  • hacky,而不是 op 要求的
猜你喜欢
  • 2021-05-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-11-21
  • 2012-12-06
  • 1970-01-01
相关资源
最近更新 更多