Search code examples
javascriptmathjaxtypeset

Using MathJax.typeset(); multiple times


I'm having a little problem regarding MathJax v3. I'm changing the values of some HTML elements multiple times and im using Mathjax.typeset(); to typeset the math components again.

Problem is, that the second time there is an expression in MathJax, MathJax.typeset() ist producing a TypeError: t is null.

I tried to reset the enumeration with:

MathJax.startup.document.state(0);
MathJax.texReset();
MathJax.typeset();

witch only led to a new TypeError: this.parent(...) is null. This only occurs the second time I call it, and I don't understand what I should do to be able to typeset the document multiple times. Any ideas?


Solution

  • You should use

    MathJax.texReset();
    MathJax.typesetClear();
    MathJax.typeset();
    

    The error that you mention is fixed in the next release (see this PR).