【问题标题】:Cannot Generate SVG using MathJax-node on sample无法在示例上使用 MathJax 节点生成 SVG
【发布时间】: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
  • 很抱歉,我错过了。你愿意这样回答吗?

标签: svg mathjax


【解决方案1】:

由于您禁用了 MathML 生成,因此您需要将 console.log() 中的 data.mml 更改为 data.svg

【讨论】:

    猜你喜欢
    • 2020-11-07
    • 1970-01-01
    • 2017-07-03
    • 2019-10-24
    • 2018-08-06
    • 1970-01-01
    • 2021-03-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多