tex-mml-svg.js:1 Uncaught Error: Unknown node type "body" while creating MathJax SVG

tex-mml-svg.js:1 Uncaught Error: Unknown node type "body" while creating MathJax SVG

我尝试根据 http://docs.mathjax.org/en/latest/web/typeset.html#converting-a-math-string-to-other-formats

使用 MathJax 创建 SVG 方程

它适用于内联方程:

\( e=mc^2 \)

但是在 JavaScript 中创建 SVG 时发生错误:

MathJax.mathml2svg("x_2 = y^3")

这里是错误:

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)

不确定这是错误还是我遗漏了什么。这里有一个 JSFiddle 说明了这个问题:https://jsfiddle.net/Imabot/xkud6o73/1/

这不是这个问题的重复:Render MathJax in an SVG file

这个问题是针对旧版本的 MathJax,我正在使用 v3.0.0。 正如您在上面看到的,我的问题不是创建内联 SVG,而是创建包含输出 SVG 的字符串。

这是一个错误,已在此处报告: https://github.com/mathjax/MathJax/issues/2330

我们将在 MathJax 版本 3.0.2 中进行更正。