I try to create an SVG equation with MathJax according to http://docs.mathjax.org/en/latest/web/typeset.html#converting-a-math-string-to-other-formats
It works fine for inline equations:
\( e=mc^2 \)
But an error occurred while creating the SVG in JavaScript :
MathJax.mathml2svg("x_2 = y^3")
Here is the error:
tex-mml-svg.js:1 Uncaught Error: Unknown node type "body"
at o.error (tex-mml-svg.js:1)
at o.makeNode (tex-mml-svg.js:1)
at o.compile (tex-mml-svg.js:1)
at c.compile (tex-mml-svg.js:1)
at T.e.compile (tex-mml-svg.js:1)
at Object.renderMath (tex-mml-svg.js:1)
at d.renderConvert (tex-mml-svg.js:1)
at T.e.convert (tex-mml-svg.js:1)
at t.Z.convert (tex-mml-svg.js:1)
at Object.v.MathJax.<computed> [as mathml2svg] (tex-mml-svg.js:1)
Not sure if this is a bug or if I missed something. Here a JSFiddle illustrating the problem: https://jsfiddle.net/Imabot/xkud6o73/1/
This is not a duplicate of this question : Render MathJax in an SVG file
This question is for older version of MathJax, I'm working with v3.0.0. As you can see above, my problem is not to create inline SVG but to create string containing the output SVG.
It's a bug, it has been reported here: https://github.com/mathjax/MathJax/issues/2330
We'll be corrected in MathJax version 3.0.2.