I have the following div:
<div id="math-display">``</div>
The page runs MathJax.Hub.Queue(['Typeset', MathJax.Hub, 'math-display']) when the page is loaded. ` is the delimiter for AsciiMath input.
If I were to use latex to enter equations, and wanted to refresh math-display, I could run the following code:
MathJax.Hub.Queue(['Text', MathJax.Hub.getAllJax('math-display')[0], 'new latex here'])
However, if I were to put AsciiMath input instead of latex, the result is still rendered with latex (even if AsciiMath delimiters are used in the 'new latex here' string). How do I update the displayed MathJax with AsciiMath input, instead of latex?
If possible, I would prefer not calling Typeset to update.
Text()method only update text of the object instance, and this object already has the type of input as a property. This type of input is defined by thedelimiterswhen the object is created.When you use
text()you modify the string that was between thedelimiters, so you don't needdelimiters, but you can't change input type.But you can
typeseta single element. It'll create a new object with the input defined by the delimiters. See snippet for example: