ASCIIMath:JS 方法获取渲染表达式的 TeX 值?
ASCIIMath: JS method to get TeX value of rendered expression?
This JSFiddle is using ASCIIMath 显示表达式 1+x^2.
如何在渲染后获取 ASCIIMath 表达式的 TeX 值?我想将该值保存到 myTeX div?
是否有 ASCIIMath 方法或 MathJax.Hub 方法来检索 TeX?
HTML + JavaScript:
<script type="text/javascript" src="js/jquery-1.4.1.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=AM_HTMLorMML-full">
</script>
<div id="myExpr">`1+x^2`</div>
<div id="myTeX"></div>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
messageStyle: 'none',
tex2jax: { preview: 'none'}
});
</script>
更新:
这是如何完成的:
JavaScript:
<script src="ASCIIMathTeXImg.js"></script>
<script>
var x = AMTparseAMtoTeX('1+5/4^2');
console.log(x);
</script>
您可能不想处理渲染,而是想处理 ASCIImath 源。
asciimath 存储库包含用于将 asciimath 转换为 LaTeX 的 PHP 脚本,请参阅 https://github.com/asciimath/asciimathml/tree/master/asciimath-based。
MathJax 中还没有内置任何内容,但在 https://github.com/mathjax/MathJax/issues/1124 提出了功能请求。
This JSFiddle is using ASCIIMath 显示表达式 1+x^2.
如何在渲染后获取 ASCIIMath 表达式的 TeX 值?我想将该值保存到 myTeX div?
是否有 ASCIIMath 方法或 MathJax.Hub 方法来检索 TeX?
HTML + JavaScript:
<script type="text/javascript" src="js/jquery-1.4.1.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=AM_HTMLorMML-full">
</script>
<div id="myExpr">`1+x^2`</div>
<div id="myTeX"></div>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
messageStyle: 'none',
tex2jax: { preview: 'none'}
});
</script>
更新:
这是如何完成的:
JavaScript:
<script src="ASCIIMathTeXImg.js"></script>
<script>
var x = AMTparseAMtoTeX('1+5/4^2');
console.log(x);
</script>
您可能不想处理渲染,而是想处理 ASCIImath 源。
asciimath 存储库包含用于将 asciimath 转换为 LaTeX 的 PHP 脚本,请参阅 https://github.com/asciimath/asciimathml/tree/master/asciimath-based。
MathJax 中还没有内置任何内容,但在 https://github.com/mathjax/MathJax/issues/1124 提出了功能请求。