Equation rendering speed, is this the best I can hope for?

Equation rendering speed, is this the best I can hope for?

by Paul Meyers -
Number of replies: 7

We have added an introductory math course to our Moodle 3.9 site using Mathjax to display equations.  

Is there any method to make the rendering faster so that the students do not see the initial "cryptic" notation?

Here is a short video showing real-time rendering currently:



Here is my filter config, I do not have Mathjax installed locally :


Average of ratings: -
In reply to Paul Meyers

Re: Equation rendering speed, is this the best I can hope for?

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Perhaps MathJax's can be configured so that equations are displayed directly without their code showing first, but only a savvy programmer could answer you.

In the meantime, you can use the following workaround. It's just a matter of delaying the display of the equation by say 1 or 1.5 seconds so that only its final form is displayed.

  • Give a class and initially hide the equation by enclosing it in a span tag as follows:
<span class="renderingspeed" style="display:none;">\(a+b=c\)</span>
  • Add the following small script in the HTML code of the question to delay the display by say 1500 ms (= 1.5 s):
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
    $(".renderingspeed").delay(1500).show(0);
});
</script>
In reply to Paul Meyers

Re: Equation rendering speed, is this the best I can hope for?

by Eoin Campbell -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
You could try using MathJax 3.0 instead of 2.7, as it seems to be twice as fast at rendering, see a comparison at https://www.intmath.com/cg5/katex-mathjax-comparison.php. You could also consider rendering using Katex instead of MathJax, see how to do this at https://moodle.org/mod/forum/discuss.php?d=358050.
One of the issues you have is that questions are on separate pages, you could consider grouping them at say 5 per page, so that the student wouldn't notice the time it takes to render questions 2 - 5.
Average of ratings: Useful (1)
In reply to Eoin Campbell

Re: Equation rendering speed, is this the best I can hope for?

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
If you are using the MathJax 3.0 URL, you may get an error. See https://moodle.org/mod/forum/discuss.php?d=410557.
Average of ratings: Useful (1)
In reply to Dominique Bauer

Re: Equation rendering speed, is this the best I can hope for?

by Paul Meyers -
Dominique, Thanks for your help, I have these items on my to do list. For now, 5 questions for page is a good work around and the students do not notice the rendering further down the page.
In reply to Eoin Campbell

Re: Equation rendering speed, is this the best I can hope for?

by Paul Meyers -
Eoin, I ended up going with 5 questions per page with the top question not requiring Mathjax. Thanks for the recommendation!