Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scale svg figure in html output of Sphinx (rest)

I have a figure in restructured text using a scale directive as follows:

.. figure:: images/my_image.svg
   :scale: 150 %

The the image is perfectly OK in the HTML output of sphinx, except that it is not scaled. (The svg image has width and height information and a viewBox)

It is strange, that in contrast to png figures, the <img> tag in the HTML file does not contain width and height attributes of the image (hm, can't sphinx determine width and height of the svg for some reason?).

What is the reason for this? Does sphinx support the :scale: directive for svg figures?

like image 416
Andreas Gschossmann Avatar asked Feb 26 '15 23:02

Andreas Gschossmann


1 Answers

You may try setting the width. This can also be assigned a percentage of the current line width as value.

.. figure:: images/my_image.svg
   :width: 100%
like image 59
Georg Avatar answered Oct 23 '22 13:10

Georg