如何在reStructuredText/Sphinx中创建浮动数字?

dmd*_*dmd 8 restructuredtext python-sphinx

我想要一个带有文字的图形.

这就是我所说的:

Installation of Optional Accessories
====================================

.. warning:: Never plug in or unplug a Hand Robot or a Grasp Sensor while the robot is turned on, as the system will not function properly and damage to the robot could occur.

Installing a Hand Robot
-----------------------

.. _`fig-attach-hand-robot`:
.. figure:: attach-hand-robot.*
  :scale: 40%
  :align: right

  Attach Hand Robot

Make sure the robot is turned off as described in the section :ref:`turn-off-robot`. 

Take the hand robot out of the grounded bin that sits on top of the electrical panel (if you have an adjustable height table) or sits on top of the rear table (if you have a fixed height table). Make sure not to touch the pins on the electrical wiring while doing so. Insert the conical protrusion of the hand robot into the conical receptacle (see :ref:`fig-attach-hand-robot`). Once the hand robot is supported by the InMotion Arm Robot, make sure the two knobs below the Hand Robot have engaged and sprung in. If they have not, twist them until they do as shown (see :ref:`fig-knobs-in`).
Run Code Online (Sandbox Code Playgroud)


这张截图PDF输出的是什么,我得到.

  • 为什么数字标题居中,而不是在图像下?
  • 为什么身体文字("确保......"和"拿......")不在图像的左侧,而不是在它下面?我希望图形向右浮动并在其左侧显示文本.

Ian*_*sco 6

所以,我对reStructuredText做了一些研究,看起来你想要的实际上是不可能的.

图形图像指令的文档从未提及在对象周围包装文本的能力.

这可能是向Sphinx开发人员提供的功能请求,尽管我怀疑他们会拒绝它,因为在第一个规范中没有明确提到它.

我希望赏金会引起一些关注,但我怀疑是没有.


小智 6

虽然为时已晚,但也许答案会对未来的人有所帮助。

您可以使用侧边栏指令来放置图像。

.. sidebar:: mandatory_title. Use can use image caption here

     .. Figure:: 1.png
Run Code Online (Sandbox Code Playgroud)


jjz*_*jjz 6

我发现数字浮动到一边:figwidth::align:指定。(使用 readthedocs 主题。)

..  figure:: images/myimage.jpg
    :figwidth: 40%
    :align: right
Run Code Online (Sandbox Code Playgroud)

https://docutils.sourceforge.io/docs/ref/rst/directives.html#figure