Skip to content

Commit

Permalink
Fix error where MathJax has not completed loading.
Browse files Browse the repository at this point in the history
Only wait 0.5 s for loading to complete. May not be enough on all systems
  • Loading branch information
jmshea committed Nov 16, 2021
1 parent 2a889a2 commit bb02d22
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions jupyterquiz/show_questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,25 @@ function show_questions(json, mydiv) {
if (typeof MathJax != 'undefined') {
console.log("MathJax version", MathJax.version);
var version = MathJax.version;
if (version[0] == "2") {
MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
} else if (version[0] == "3") {
MathJax.typeset([mydiv]);
} else {
console.log("MathJax not found");
setTimeout(function(){
var version = MathJax.version;
console.log('After sleep, MathJax version', version);
if (version[0] == "2") {
MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
} else if (version[0] == "3") {
MathJax.typeset([mydiv]);
}
}, 500);
if (typeof version == 'undefined') {
} else
{
if (version[0] == "2") {
MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
} else if (version[0] == "3") {
MathJax.typeset([mydiv]);
} else {
console.log("MathJax not found");
}
}
}
return false;
Expand Down

0 comments on commit bb02d22

Please sign in to comment.