Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tex2svg converted image further rendering problem #464

Open
StarryField opened this issue Sep 13, 2020 · 1 comment
Open

tex2svg converted image further rendering problem #464

StarryField opened this issue Sep 13, 2020 · 1 comment
Labels

Comments

@StarryField
Copy link

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

  • Operating environment
ubuntu@ubuntu:~$ node -v
v14.10.1
ubuntu@ubuntu:~$ npm -v
6.14.8
  • Used command
ubuntu@ubuntu:~/Desktop$ tex2svg "\text{TEST}" > test.svg
ubuntu@ubuntu:~/Desktop$ convert test.svg test1.png
ubuntu@ubuntu:~/Desktop$ convert test.svg test1.jpg
ubuntu@ubuntu:~/Desktop$ inkscape -z -w 512 -h 512 test.svg -e test2.png
ubuntu@ubuntu:~/Desktop$ inkscape -z -w 512 -h 512 test.svg -e test2.jpg
@dpvc
Copy link
Member

dpvc commented Sep 26, 2020

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.

@dpvc dpvc added the Question label Sep 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants