5

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.

Knorke
  • 257
  • 4
  • 13

2 Answers2

9

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
Cole
  • 1,699
  • 1
  • 17
  • 21
  • 1
    It's working fine, I wont use the .. image:: command anymore! – Knorke Sep 17 '13 at 15:01
  • I am using `make latexpdf` to generate pdf file from my Sphinx project. However I am running into image insertion issue. Could you please check my [question](https://stackoverflow.com/questions/63452024/how-to-include-image-files-in-sphinx-latex-pdf-files) here? – shaan Aug 18 '20 at 13:15
-2

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
user-asterix
  • 826
  • 8
  • 12