Adding Vertical Space in Sphinx Documents
Asked Answered
S

2

18

I am using sphinx to build latex and HTML documents with a lot of figures and enumerated lists. When I use figures in the middle of text outside of enumerated lists, the spacing is fine in both latex and HTML with and without captions. There is about a line of space above and below, which is acceptable. However When I try to use a figure within enumerated lists, such as the example below, the spacing is bad in HTML.

#.    Here is an item in the list, above the figure

      .. figure:: _images/myimage.png
          :align: center
          :width: 80 %

#.    Here is another item below the figure.

The result of the above code is the bottom of the figure is right up against the next item in the list. There is no spacing between them, and this looks bad. This can be fixed in HTML by using the | character at the end of the figure to add a little space, but in the LaTeX output, this causes a DUlineblock environment that adds way too much space in the pdf.

Is there a way to simply add a single blank line after the figure in both HTML and Latex?

Stopoff answered 30/6, 2014 at 13:39 Comment(0)
C
28

You can enter empty lines with:

text

|

text
Celibate answered 12/11, 2014 at 12:21 Comment(0)
S
3

I found that the replacement:

.. |br| raw:: html

    <br />

Works well for adding a black line after a figure in enumerated lists. Since its a raw substitution it only affects html and the figure spacing in latex is fine without modification.

Stopoff answered 1/7, 2014 at 11:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.