2

I was trying to create SVG output from TikZ and ran into some problems. These have now been resolved, but the result is that I'm asking myself where my misunderstanding is or if the manual is wrong.

I'm using MikTeX on Windows and I'm referring to version 3.0.1a of the manual.

I followed the example in the manual and created this document

\documentclass[dvisvgm]{minimal}
\usepackage{tikz}

\begin{document}
Hello \tikz [baseline] \fill [fill=blue!80!black] (0,.75ex) circle[radius=.75ex];
\end{document}

I then ran latex test.tex and dvisvgm test.dvi. This created an SVG file, but one where the circle didn't show up in the web browsers I tried it with. The reason is that the SVG element has these attributes:

height='6.9185pt' viewBox='19.9253 3.04414 22.416 6.9185' width='22.416pt'

Apparently, it is just big enough for the text and the circle is ignored. (More tests show that if I only have graphics and no text, the SVG element has dimensions 0pt times 0pt.)

But if I change the first line of the example above to

\documentclass{standalone}

then suddenly everything works fine and the SVG is correct:

height='6.9185pt' viewBox='-72 -72 32.1719 6.9185' width='32.1719pt'

My questions:

  • Why is the example from the manual not working? Is that a mistake or am I missing something?
  • What's the point of the drivers the manual talks about and were they actually used? In the example that works for me, I never mentioned the [dvisvgm] option anywhere. As far as I can see, I compiled the .tex file as usual and the dvisvgm program did the job of converting the .dvi output to SVG. I understand that someone needs to tell PGF/TikZ to create a .dvi file suitable for SVG conversion, but who did that? Did the standalone package do it automatically?

Your Answer

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

Browse other questions tagged or ask your own question.