This JSFiddle is using ASCIIMath to show the expression 1+x^2.
How can I get TeX value of ASCIIMath expression after it has been rendered? I want to save that value into myTeX div?
Is there an ASCIIMath method or MathJax.Hub method to retrieve 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>
UPDATE:
Here is how its done:
JavaScript:
<script src="ASCIIMathTeXImg.js"></script>
<script>
var x = AMTparseAMtoTeX('1+5/4^2');
console.log(x);
</script>