gpt4 book ai didi

javascript - ASCIIMath:获取渲染表达式的 TeX 值的 JS 方法?

转载 作者:行者123 更新时间:2023-12-03 08:50:12 25 4
gpt4 key购买 nike

This JSFiddle正在使用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 .

除了 https://github.com/mathjax/MathJax/issues/1124 上的功能请求外,MathJax 中尚未内置任何内容。 .

关于javascript - ASCIIMath:获取渲染表达式的 TeX 值的 JS 方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32707679/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com