Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How insert some space before and after images in Sphinx

I created a document via Sphinx with the make latexpdf command.

Now I have the problem that LaTeX is setting my picture at the top directly after the text and at the bottom of the image it puts 3 or 4 linebreaks.

Is there a possibility to get 1 space at the top and 1 space at the bottom of the picture without having to use a \ in the syntax?

My code:

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

some text

.. image:: screenshots/manage_products.png

some more text

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

EDIT: Here a little Screenshot to show you my problem. I also looked into the main documentation of Sphinx (+ Syntax documentation) and found no answer for this problem!

enter image description here

Btw: Ignore the red arrow plz.

like image 209
Knorke Avatar asked Jul 26 '13 13:07

Knorke


People also ask

How do I jump to the introduction page in Sphinx?

For instance, the introduction page is an external page with a link called introduction at the top of the page. You can jump there by writting :ref:`introduction`, which appears as: Why Sphinx and for which users ?. Note that if you use the ref role, the final underscore is not required anymore. 1.2.4. List and bullets ¶ * This is a bulleted list.

How to include formatted text in a code block in Sphinx?

Sphinx and the RST syntax provides directives to include formatted text. As an example, let us consider the code-block syntax. It allows to insert code (here HTML) within your document: .. code-block:: html :linenos: <h1>code block example</h1>. Its rendering is: 1. <h1> code block example </h1>.

What units does Sphinx use for its output?

Other units (like pt for points) will be used for HTML and LaTeX output (the latter replaces pt by bp as this is the TeX unit such that 72bp=1in ). Sphinx extends the standard docutils behavior by allowing an asterisk for the extension: .. image:: gnu.* Sphinx then searches for all images matching the provided pattern and determines their type.

What is the path to the image in the Sphinx?

The path to the image is relative to the file. See the Sphinx documentationfor more information. Share Improve this answer Follow answered Sep 16 '14 at 22:52 devin_sdevin_s


1 Answers

You could use the .. figure:: directive to add the extra spacing you would like around your image.

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

some text

.. figure:: screenshots/manage_products.png

some more text

I like using the figure directive more as well, since you have some additional control elements to your image, such as labeling.

.. figure::

   Your figure text here
like image 69
Cole Avatar answered Oct 21 '22 22:10

Cole