mathjax / MathJax-node

MathJax for Node
Apache License 2.0
616 stars 97 forks source link

tex2svg converted image further rendering problem #464

Open StarryField opened 4 years ago

StarryField commented 4 years ago

I tried to use mathjax-node-cli and imagemagick or inkscape on Ubuntu Server 20.04 LTS (on arrch64 bulid) to turn my math formula into .jpg picture, but the final converted result is a blank picture! ! ! I think this is a problem with mathjax-node, because they can convert .svg files from other sources normally

dpvc commented 4 years ago

The reason for this is that MathJax sets the fill and stroke properties to currentColor so that the SVG will inherit the font color in the browser. That is confusing ImageMagick and Inkscape. You need to change currentColor to black (or whatever color you want).

One way to do that would be to pipe your output through sed before saving it to the file:

tex2svg "\text{TEST}" | sed -e s/currentColor/black/g > test.svg

That does the trick for me.