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:

enter image description here

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:


$\alpha \lim\limits_{\leftarrow} \beta$
  • 1
    Please edit your question and add the complete LaTeX code.
    – AlexG
    Nov 26, 2018 at 22:41
  • 6
    Use dvisvgm to directly produce SVG as a vector graphics.
    – AlexG
    Nov 26, 2018 at 22:43
  • @AlexG Thanks! I will use dvisvgm Nov 26, 2018 at 22:47
  • @AlexG Would you mind posting an answer?
    – user121799
    Nov 27, 2018 at 0:52
  • @AlexG sure I will make an answer Nov 27, 2018 at 16:03

1 Answer 1


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:

enter image description here

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

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.