我是 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>⁢</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 内容本身内的表达式。
谢谢
最佳答案
您只需添加 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>⁢</mo>
<mi>x</mi>
</mrow>
<mo>+</mo>
<mn>4</mn>
</mrow>
<mo>=</mo>
<mn>0</mn>
</mrow>
</math>
</body>
</html>
关于javascript - 如何从 MathJAX.js 获取 MathExpression,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45166013/