【发布时间】:2018-12-12 20:47:25
【问题描述】:
MathJax 和 Node 新手在尝试使用此处 https://github.com/mathjax/MathJax-node 中稍作修改的示例生成 svg 时得到 undefined 输出
// a simple TeX-input example
var mjAPI = require("mathjax-node");
mjAPI.config({
MathJax: {
// traditional MathJax configuration
}
});
mjAPI.start();
var yourMath = 'E = mc^2';
mjAPI.typeset({
math: yourMath,
format: "TeX", // or "inline-TeX", "MathML"
svg:true, // was mml:true
}, function (data) {
if (!data.errors) {console.log(data.mml)}
});
示例运行:-
C:\Users\user\Desktop\math-eqn>node math-eqn.js
undefined
原始样本工作正常:-
C:\Users\user\Desktop\math-eqn>node math-eqn.js
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block" alttext="E = mc
^2">
<mi>E</mi>
<mo>=</mo>
<mi>m</mi>
<msup>
<mi>c</mi>
<mn>2</mn>
</msup>
</math>
【问题讨论】:
-
尝试将
data.mml更改为data.svg。 -
很抱歉,我错过了。你愿意这样回答吗?