# Is it possible to go directly from LaTeX to SVG?

I have a situation where I'm calling latex.exe in the background and then dvipng on it and then loading the file into a QGraphicsScene using QGraphicsImageItem and the result is horrible upon zooming out:

this is unprofessional. I can't release the app like this. So I decided to go with online-convert.com to start out with and maybe a paid service if needed (Convertio is $7 / month for starters). Which would take the latex / dvipng -generated PNG file and convert the symbols into SVG paths (.svg file). These online services have APIs to connect to them and do it all programatically. But why use one if it's possible somehow to get the SVG straight from LaTeX source files some how? Please guide. Thanks. Here is the LaTeX template my program uses. I just realized it's missing dpi information, which I have a class variable for, but it's not appearing in the TeX: \documentclass[varwidth]{standalone} \usepackage{lmodern} \begin{document}\fontsize{30}{36}\selectfont$\alpha \lim\limits_{\leftarrow} \beta\$
\end{document}

• Please edit your question and add the complete LaTeX code. – AlexG Nov 26 '18 at 22:41
• Use dvisvgm to directly produce SVG as a vector graphics. – AlexG Nov 26 '18 at 22:43
• @AlexG Thanks! I will use dvisvgm – Shine On You Crazy Diamond Nov 26 '18 at 22:47
• @AlexG Would you mind posting an answer? – user121799 Nov 27 '18 at 0:52
• @AlexG sure I will make an answer – Shine On You Crazy Diamond Nov 27 '18 at 16:03

## 1 Answer

If you have latex installed you probably have dvisvgm command on your path. So go to your command line and type that in to make sure it works.

Then replace your call to dvipng with that for dvisvgm. My basic call in code expands to:

dvisvgm latex_input.dvi

Loading those into your scene with QtSvg.QGraphicsSvgItem (using the file latex_input.svg produced above) produces the following beautiful result:

Zoomed out that is! It looks even better at standard zoom.