2013-05-09 2 views
7

텍스트를 감싸는 그림이 필요합니다.reStructuredText/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`). 


및 그림 캡션이 아닌 이미지 아래, 중앙 왜 this screenshot of PDF output is what I'm getting.

  • 을 :

    이 무슨 말인지입니까?

  • 이미지의 아래쪽이 아니라 이미지의 왼쪽에 본문 텍스트 ("확인하십시오"및 "가져 오기 ...")가 표시되지 않는 이유는 무엇입니까? 나는 그림을 오른쪽으로 띄우고 그 왼쪽에 텍스트를 넣기를 원합니다.

답변

6

그래서 저는 reStructuredText에 대한 연구를했는데 실제로 원하는 것은 아닌 것 같습니다.

figureimage 지시문에 대한 설명서는 개체 주위의 텍스트를 줄 바꿈하는 기능에 대해 언급하지 않습니다.

이것은 처음 스펙에서 명시 적으로 언급되지 않았기 때문에 Sphinx 개발자가 거부 할 것으로 생각되지만 Sphinx 개발자에게 제공하는 기능 요청 일 수 있습니다.

나는 현상금이이 약간주의를 축적 할 것이라는 점을 희망하고 그러나 나는이지 않는다는 것을 의심한다.

0

이미지를 텍스트의 일부로 처리하기 위해 실제로는 substitutions을 사용할 수 있습니다. 여기

도움이 될 수있는 문서로부터 추출 : 나는 다른 사람이 다음 코드의 비트가 도움이 될 수있는이 문제에 실행하는 경우이

+0

프로그램 목록을 실행합니다. – Frotz

1

도움이되기를 바랍니다

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

.. |biohazard| image:: biohazard.png 

. 나는 실제 스핑크스 코드를 해킹하고 싶지 않기 때문에 매우 짧은 파이썬 스크립트를 생성하여 _build/latex/pi3d_book.tex에 적용하여 을 \hfill으로 변환하거나 줄 바꿈 이미지로 변환했다. 이미지를 목록 안에 넣거나 이미지 크기를 조정하는 등의 작업을 중단시키는 많은 것들이있을 것입니다. 필자의 첫 번째 스핑크스 지시문은 다음과 같다.

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

분명히 설정에 맞게 파일 이름과 경로를 변경해야한다. 내 spinx 프로젝트에서 나는 하나의 챕터의 시작 부분에 큰 불이 편지를 넣어 필요가있는 경우 이것은 매우 도움이되지 않습니다 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")