-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Can't make callback from given data #3244
Comments
In your code MathJax.Hub.Queue(["Typeset", MathJax.Hub ,"math"]);
var mathnode = MathJax.Hub.getAllJax("math")[0];
MathJax.Hub.Queue(["Text", mathnode, mathbody]); // line causing the error
if (callback) { MathJax.Hub.Queue(callback); } you first queue a typeset action, and then try to look up the typeset math. But the queued action does not occur at the time your make the You need to queue your MathJax.Hub.Queue(
["Typeset", MathJax.Hub ,"math"],
function () {
var mathnode = MathJax.Hub.getAllJax("math")[0];
MathJax.Hub.Queue(["Text", mathnode, mathbody]);
if (callback) { MathJax.Hub.Queue(callback); }
}
); would do it. You don't need the outer queued function with the try-catch, as that will only catch an error in the outer Finally, if this is code you are writing new, it might be better to use MathJax v3 than the much older v2. MathJax v3 is faster, and uses a more modern API (based on promises rather than MathJax v2's custom queues and callbacks). |
Hey @dpvc, thanks for responding. As of now it's legacy code that we're trying to maintain as we're not yet planning to migrate to MathJax 3 since that would require considerable effort. I tried what you suggested & that solved the issue. Thanks again! |
Issue Summary
We're using Mathjax library to render math equations & getting the following error.
The following is the html code snippet.
Note that mathjax is being loaded in init.js as follows
The global.js snippet where we're getting the error
Technical details:
The text was updated successfully, but these errors were encountered: