Uncaught Error: MathJax retry

19 views
Skip to first unread message

Dennis Erwin

unread,
Jan 27, 2023, 3:33:59 PM1/27/23
to MathJax Users
We're trying to use MathJax on our site but are running into an intermittent issue with some of our users, and I'm hoping someone can offer some help or direction on how we might fix this, or at least where we can start looking to diagnose the problem.

Most of the time, we have no problems. But we are getting reports from users (primarily teachers at public schools) of the following error. We have not been able to get it to repeat locally.

tex-mml-chtml.js:1 Uncaught Error: MathJax retry
    at e.retryAfter (tex-mml-chtml.js:1:754737)
    at e.checkLoading (tex-mml-chtml.js:1:724633)
    at Object.renderDoc (tex-mml-chtml.js:1:39265)
    at e.renderDoc (tex-mml-chtml.js:1:39488)
    at t.render (tex-mml-chtml.js:1:42447)
    at e.MathJax.typeset (tex-mml-chtml.js:1:26145)
    at Object.onLoad (application.js?version=1135:2784:17)
    at Ajax.Client._processResponse (ajax.js?version=1135:188:33)
    at Ajax.Client._processStateChange (ajax.js?version=1135:169:18)
e.retryAfter @ tex-mml-chtml.js:1
e.checkLoading @ tex-mml-chtml.js:1
(anonymous) @ tex-mml-chtml.js:1
e.renderDoc @ tex-mml-chtml.js:1
t.render @ tex-mml-chtml.js:1
e.MathJax.typeset @ tex-mml-chtml.js:1
onLoad @ application.js?version=1135:278

So as far as I can tell MathJax is initializing fine but then having to retry something and that retry is failing.


Thanks so much for any help!

Davide Cervone

unread,
Jan 27, 2023, 3:44:43 PM1/27/23
to mathja...@googlegroups.com
In some situations, MathJax needs to load an additional file, for example, when a TeX command causes a TeX extension to be auto-loaded (as with \cancel, for example).  In that case, MathJax must load additional code before it can process the complete expression, and that process is asynchronous, meaning MathJax just wait for the code to arrive.  That means the code that calls MathJax needs to know to be able to handle that, and so MathJax provides asynchronous typesetting via the MathJax.typesetPromise() function.  The "retry" error is used to tell typesetPromise() to wait for the code to arrive and then retry the typesetting.  The MathJax.typeset() call, which you appear to be using (the second to last line in your error message) is a synchronous-only call, and does not handle loading of extra code, as it expects everything needed to do the typesetting to be loaded already.

So the solution is to switch to using the MathJax.typesetPromise(), which returns a promise that is resolved when the typesetting is complete.  Note that the function will return BEFORE the typesetting is even begun, so you may need to use that promise to synchronize other actions in your application (like not try to typeset anything else until that promise is resolved).  See


for more details.

Davide


--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/51ec20b6-5ee3-4dd9-9328-13e565a8e4e4n%40googlegroups.com.

Dennis Erwin

unread,
Jan 27, 2023, 4:02:16 PM1/27/23
to MathJax Users
Thank you so much! This is very helpful
Reply all
Reply to author
Forward
0 new messages