MathJax: Hide page until all math formulas are typesetted

1

1

A typical page with numerous math formulas is usually typesetted by MathJax in "slow motion": You are shown the LaTeX codes in gray first, before the formulas are converted one by one. Is it possible to configure MathJax / use Javascript in such a way that this typesetting process is hidden, so that nothing is shown (meaning you only see a blank page) until all formulas are ready?

user71815

Posted 2013-11-25T16:21:19.420

Reputation: 111

Do you want to hide the the TeX code or the entire content (math and non-math)? – Peter Krautzberger – 2013-11-25T23:24:15.843

@PeterKrautzberger Sorry I meant we are supposed to be shown a blank page until all formulas are rendered. Please see the edit. – user71815 – 2013-11-26T11:30:32.047

Answers

1

This really depends on how fancy you want to be, but the quick and dirty way is to hide everything and use the MathJax queue to turn things visible.

1) make your main element visibility:hidden (don't use display:none, this can interfere with MathJax)

2) Then, after the call to MathJax.js, add a script to remove hidden after the initial bunch of elements in the MathJax queue have been cleared (i.e., the initial typesetting is done). Something like this

MathJax.Hub.Queue(
   function () {
     document.getElementById('MainID').style.visibility = "";
}

);

should do the trick -- see http://jsfiddle.net/26rvZ/

I hope this gets you started.

Peter Krautzberger

Posted 2013-11-25T16:21:19.420

Reputation: 171