Skip to content

Conversation

@simbilod
Copy link

@simbilod simbilod commented Jan 1, 2026

I dynamically generate figures with math, and couldn't find this functionality.

Added it to my fork, but contributing back in case it's useful -- feel free to merge or close!

image

@spakin
Copy link
Owner

spakin commented Jan 5, 2026

Thanks for the pull request! I also appreciate that you included a file of examples.

However, although I use LaTeX extensively myself (see https://www.pakin.org/~scott/latex-stuff.html), I find that support for LaTeX formulas in Simple Inkscape Scripting is a bit too specialized of a feature to include. I apologize, but I'm going to close this pull request without merging it.

I did test your formula function, though. It generally worked, but I had a few small issues:

  • subprocess.run isn't honoring my PATH. This clearly is not a problem with your code, but I don't know if the issue is with inkex or Inkscape itself. Consequently, formula is picking up my /usr/bin/pdflatex, which comes from a minimalist TeX installation that lacks preview.sty, instead of my /usr/local/bin/pdflatex, which comes from a complete TeX Live installation.
  • Formulas are coming out vertically flipped. Your code's scale(1,-1) apparently is unnecessary on my system. I tested with one of the standard Inkscape templates.

Again, thanks for your contribution to Simple Inkscape Scripting.

@spakin spakin closed this Jan 5, 2026
@simbilod
Copy link
Author

simbilod commented Jan 5, 2026

Makes sense, I also found it somewhat unwieldy.

Do you have a preferred way to script equations into SVG graphics?

@spakin
Copy link
Owner

spakin commented Jan 6, 2026

Not really. I know of the TexText extension but have not run it myself. For bulk conversions, I'd look at dvisvgm, but I don't know how good that is with equations.

Your approach is probably as good as it gets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants