2

Using docutils, it doesn't seem possible to align an image both horizontally and vertically in reStructuredText. Vertical alignment is only accepted for substitutions, while horizontal alignment only works for inline images, thus:

.. image:: some/image.png
   :align: middle

and

.. |name| image:: some/image.png
   :align: center

crash.

Is there a way to control both the vertical and horizontal alignments?

raphink
  • 3,625
  • 1
  • 28
  • 39
  • According to the docutils [image directive specification](http://docutils.sourceforge.net/docs/ref/rst/directives.html#image) `align` can take the values "top", "middle" or "bottom" for vertical alignment and "left", "center", or "right" for horizontal alignment. What do you mean your code examples crash? Do you get any error messages? – Chris Jul 04 '12 at 08:28
  • It’s a bit saddening that they dump a class into the html instead of actually using the align html attribute. – remmy Dec 12 '14 at 22:36

1 Answers1

1

I got an answer:

Since :align is based on the HTML definition of alignment, it doesn't make sense (in general) to align images vertically in the page (in my case, I'm doing a presentation, so vertically aligning in slides makes sense).

For that reason, standalone images can only be horizontally aligned, while inline images can only be vertically aligned (on the base line).

raphink
  • 3,625
  • 1
  • 28
  • 39