Numbers without text don't render when using tex2svg
alcastaneda opened this issue · 3 comments
alcastaneda commented
Running node -r esm tex2svg 408
and node -r esm tex2svg -30
generates:
<svg style="vertical-align: 0;" xmlns="http://www.w3.org/2000/svg" width="0.036ex" height="0.036ex" role="img" focusable="false" viewBox="0 0 16 16" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style>svg a{fill:blue;stroke:blue}[data-mml-node="merror"]>g{fill:red;stroke:red}[data-mml-node="merror"]>rect[data-background]{fill:yellow;stroke:none}[data-frame],[data-line]{stroke-width:70px;fill:none}.mjx-dashed{stroke-dasharray:140}.mjx-dotted{stroke-linecap:round;stroke-dasharray:0,140}use[data-c]{stroke-width:3px}</style></defs><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="scale(1,-1)"><g data-mml-node="math"></g></g></svg>
Which appears to be an empty svg
dpvc commented
Most peculiar. I will have to look into it further.
dpvc commented
OK, it turns out that the yargs
command argument parsing turns arguments that are numbers into javascript numbers rather than strings, since MathJax.tex2svgPromise()
expects a string, then it is passed a number it doesn't parse properly. So one solution would be to change argv._[0]
to String(argv._[0])
in the tex2svg
command file. I'm not sure which tex2svg
you are using (there is one in most of the directories), but you should be able to fix the one you are using with that change.
alcastaneda commented
@dpvc that worked! thank you!