1

I installed MikTex on Windows 10 (basic-miktex-2.9.6520-x64.exe) and ghostscript (gs922w64.exe), and I am using "latex2svg.py." I'm wanting to generate SVG files from Python. This is the Python script I'm running:

from latex2svg import latex2svg

eqs = r"""
e^{i\pi}+1=0
\int_{-\infty}^{\infty}{\frac{e^{\frac{-x^2}{2}}}{\sqrt{2\pi}}}\ dx=1
""".split("\n")[1:-1]

for ii, eq in enumerate(eqs):
  myeq = r'\( ' + eq + r' \)'
  out = latex2svg(myeq)

  with open('out{}.svg'.format(str(ii + 1).zfill(2)), 'w') as f:
    f.write(out['svg'])

When I run it, I get:

    PS Z:\latex2svg test> python .\testsvg.py
    Warning: libgs not found
    PS Z:\latex2svg test>

And these are the files it outputs (notice how they look incomplete): enter image description here

If I install tex-live on Ubuntu and run the exact same Python code, I get these results:

enter image description here

These look correct. So for some reason they aren't rendering correctly on Windows (the file sizes on Windows are also smaller). Why? What do I need to do to get the equations to render correctly on Windows? I'm using Python 3.8. I have the problem even after restarting the computer.

1
  • @ITThugNinja, it doesn't seem to be releated to Python. If I run the same command (what Latex2svg.py is doing) from commandline, I have the same issue. So it's something to do with my version of Miktex I think, or perhaps the way my latex code is specified. It should be unrelated to Python. Commented Apr 15, 2021 at 22:59

1 Answer 1

1

I figured it out. Turns out I didn't have the "libertine" font installed. I had to use Miktex package manager to install it. It can also be downloaded here:

http://mirrors.ibiblio.org/CTAN/systems/win32/miktex/tm/packages/

as "libertine.tar.lzma."

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .