如何创建新结构化/狮身人面像漂浮的数字?

问题描述 投票:8回答:4

我想有文字缠着一个数字。

这是我在说什么:

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`).

this screenshot of PDF output is what I'm getting.

  • 为什么图题居中,而不是图像下?
  • 为什么不能正文(“确保...”和“取...”)上的图像的左侧,而不是它的下面?我想这个数字浮动权,并有在它的左边的文字。
python-sphinx restructuredtext
4个回答
6
投票

所以,我做了一些研究reStructuredText的,似乎你想要的东西实际上不太可能。

对于figureimage指令的文档别说环绕对象文本的能力。

虽然我怀疑他们会拒绝它,因为它没有明确地在第一个说明书中提到的,这可能是一个功能请求,提供给开发者的狮身人面像。

我希望赏金将争取一些这方面的关注,但我怀疑是没有。


2
投票

虽然为时已晚,但也许答案将有助于未来的人。

您可以使用边栏指令把图像。

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

     .. Figure:: 1.png

1
投票

为了应对图像,因为他们是你实际上可能使用substitutions文本的一部分。

这里从可以帮助文档的摘录:

The |biohazard| symbol must be used on containers used to
dispose of medical waste.

.. |biohazard| image:: biohazard.png

我希望这有帮助


1
投票

如果别人运行到这个问题,那么这段代码可能是一个帮助。我决定,我不想砍实际斯芬克斯代码,所以我做了应用于生成_build/latex/pi3d_book.tex到之前或之后到包裹的图像有\includegraphics\hfill转换很短的Python脚本。会有很多的事情,停止此工作,例如把图片内的列表或缩放图像。在我的第一个狮身人面像的指令都喜欢

.. image:: perspective.png
   :align: right

显然,你需要更改文件名和路径,以满足您的设置。从我spinx项目,我跑

$ make latexpdf
$ python wrapfix.py # or whatever you call this file

wrapfix.py的节目列表

import subprocess

with open("_build/latex/pi3d_book.tex", "r") as f:
  tx = f.read().splitlines()

txnew = []
flg1 = True
for line in tx:
  if line == "" and flg1:
    txnew += ["\\usepackage{wrapfig}",""]
    flg1 = False # just do this once before first blank line
  elif "includegraphics{" in line and "hfill" in line:
    fname = line.split("{")[2].split("}")[0]
    if line.startswith("{\\hfill"): # i.e. right justify
      fl_type = "R"
    else:
      fl_type = "L"
    txnew += ["\\begin{wrapfigure}{" + fl_type + "}{0.35\\textwidth}",
              "\\includegraphics[width = 0.3\\textwidth]{" + fname + "}",
              "\\end{wrapfigure}"]
  else:
    txnew += [line]

txnew = "\n".join(txnew)
with open("_build/latex/pi3d_book.tex", "w") as fo:
  fo.write(txnew)

subprocess.Popen(["pdflatex", "pi3d_book"], cwd="/home/jill/pi3d_book/_build/latex")
© www.soinside.com 2019 - 2024. All rights reserved.