reStructuredText/Sphinx 中的图像网格 [英] Image grid in reStructuredText / Sphinx

查看:48
本文介绍了reStructuredText/Sphinx 中的图像网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Sphinx 为我正在处理的 Python 项目创建文档.我想在 1x3 网格中显示三张图像(即都在同一行上),我想弄清楚如何在 reStructuredText 中执行此操作.现在我有

I'm using Sphinx to create documentation for a Python project I'm working on. I have three images I would like to display in a 1x3 grid (i.e. all on the same line), and I'm trying to figure out how to do this in reStructuredText. Right now I have

.. image:: _images/report_title.png

.. image:: _images/report_slide1.png

.. image:: _images/report_slide2.png

我曾想尝试在一行中围绕它们构建一个 reST 表,但这似乎有点荒谬.如何对这些图像进行网格化?

I thought about trying to build one of the reST tables around them on a single line, but that seemed a little ridiculous. How can I grid these images?

推荐答案

您可以为每个图像指定 width 选项(请参阅 reStructuredText 图片指令文档) 大约为页面宽度的三分之一或更少.

You can specify the width option for each of your images (see the reStructuredText image directive documentation) to be approximately one third or less of the width of the page.

试试,例如

.. image:: _images/report_title.png
   :width: 30%
.. image:: _images/report_slide1.png
   :width: 30%
.. image:: _images/report_slide2.png
   :width: 30%

宽度(和高度)选项中允许的长度在此处讨论(它们本质上对应于 CSS 文档中的长度单位).

The lengths allowed in the width (and height) options are discussed here (they essentially correspond to the length units in CSS documents).

这篇关于reStructuredText/Sphinx 中的图像网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆