Knorke
Knorke

Reputation: 267

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.

Upvotes: 6

Views: 5702

Answers (2)

user-asterix
user-asterix

Reputation: 936

Wanted to add a narrow line after the image and tried all sorts of combinations and all either did not work or gave a wide line after the image.

Ended up creating a tiny empty.png image and inserted into the page with the following:

.. image:: _static/main.png 
    :align: center
    :scale: 70 %    

.. image:: _static/empty.png 
.. empty.png image above to add space after main.png image

Upvotes: -2

Cole
Cole

Reputation: 1769

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

Upvotes: 11

Related Questions