【问题标题】:How can I get the MathExpression from MathJAX.js如何从 MathJAX.js 获取 MathExpression
【发布时间】:2017-07-18 11:52:15
【问题描述】:

我是 MathMl 的新手。

我有以下 MathML

<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
  <mrow>
    <msup>
      <mi>x</mi>
      <mn>10</mn>
    </msup>
    <mo>+</mo>
    <mrow>
      <mn>4</mn>
      <mo>&InvisibleTimes;</mo>
      <mi>x</mi>
    </mrow>
    <mo>+</mo>
    <mn>4</mn>
  </mrow>
  <mo>=</mo>
  <mn>0</mn>
</mrow>
</math>

如何使用 MathJax 获得对应的 MathExpression,即 x^10 +4x+4=0。

我需要 javascript 变量或生成的 html 内容本身的表达式。

谢谢

【问题讨论】:

    标签: javascript mathjax mathml


    【解决方案1】:

    您只需像这样添加 MathJax 库:

    <!DOCTYPE html>
    <html>
    
    <head>
      <title>MathJax TeX Test Page</title>
      <script type="text/x-mathjax-config">
        MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
      </script>
      <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML">
      </script>
    </head>
    
    <body>
      <math xmlns='http://www.w3.org/1998/Math/MathML'>
    <mrow>
      <mrow>
        <msup>
          <mi>x</mi>
          <mn>10</mn>
        </msup>
        <mo>+</mo>
        <mrow>
          <mn>4</mn>
          <mo>&InvisibleTimes;</mo>
          <mi>x</mi>
        </mrow>
        <mo>+</mo>
        <mn>4</mn>
      </mrow>
      <mo>=</mo>
      <mn>0</mn>
    </mrow>
    </math>
    </body>
    
    </html>

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-08-30
    • 2020-12-30
    • 1970-01-01
    • 2021-12-29
    • 1970-01-01
    • 1970-01-01
    • 2018-04-06
    • 2021-05-16
    相关资源
    最近更新 更多