1

The org-mode source

#+OPTIONS: toc:nil creator:nil author:nil timestamp:nil num:t validate:nil
#+OPTIONS: tex:dvisvgm
#+LaTeX_HEADER: \usepackage{tikz}

\begin{tikzpicture}
   \draw (0,0) circle (3cm);
\end{tikzpicture}

exports cleanly to HTML.

The tex option can be changed from dvisvgm to dvipng or imagemagick and it continues to work, but with a difference: When using dvipng or imagemagick the image size is constant; when using dvisvgm the image size is automatically adjusted to occupy the maximum space available. This means that the image size changes as the browser window is resized.

Is there a way to keep the image size constant when exporting images created by LaTeX snippets to HTML via SVG?

3

ox-html uses object tags of the org-svg class to embed the generated SVG files. The default stylesheet has the following rule:

.org-svg { width: 90%; }

This leads to embedded SVGs that take up 90% of the screen space. Such as below: Equation takes 90% of the width

This can be solved by overriding this in your own stylesheet:

.org-svg { width: auto; }

The output is then not scaled proportionally to the width anymore: enter image description here

  • 1
    Interesting. Any way to get the baseline to match up? – Andrew Swann Sep 24 '17 at 10:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.