# Feature request: user script or option to turn off instant MathJax rendering

In view of the nearly unbearable slowdowns I experience while composing answers (both in Safari 5 and Firefox 5 on OS X 10.6.7) since June 21/22 I would most welcome a possibility to reverse this state, at least locally on my machine.

The easiest possibility (from the user perspective) would probably be to introduce a user option where one could choose between the options of:

• instant rendering,
• a rendering delay of $5$ seconds (as it was some weeks ago),
• turn automatic MathJax rendering off entirely

while composing questions and answers. If the last option should happen to be implemented, a button "one shot preview" as on MathOverflow would be very nice.

I tried to adapt the user script by KennyTM given here, but lacking JavaScript expertise I was unable to do that. If someone could provide a solution involving Greasemonkey that would be fine with me, too. Some hints or indications on how to implement such a user script would also be appreciated, of course.

-
Also, if rendering isn't instant, it would be nice to have some easily typed command that immediately initiates rendering, so one doesn't have to suffer delays. Perhaps one could even set the delay as the time between two commands, or somesuch. – Bill Dubuque Jul 10 '11 at 21:13
I think the actual problem is that currently when one changes one formula, many other formulas get re-parsed. Fixing it would be an easy performance optimization, right? :) – Alexei Averchenko Jul 17 '11 at 10:49
Also a problem for me on latest version of Chrome on OS X 10.6.8. My guess (based on the age of the laptop I am on) is that this is a wimpy-hardware issue rather than a browser issue. – Carl Mummert Jul 17 '11 at 11:43
@Carl: I don't think it is. I've got a pretty new (1 year old) MacBook Pro. If indeed the site requires stronger hardware than that, then there is a serious design problem. – t.b. Jul 17 '11 at 11:57
@Theo: that's interesting, since I always blamed it on my old laptop. If the site can't run on that hardware then there is certainly something amiss. I wonder whether the same thing happens on Windows? Unfortunately I don't have any way to check. – Carl Mummert Jul 17 '11 at 12:56
+1 for option to turn off MathJax and +10 for the one-shot preview. I am using FireFox 3.6.24 on MacOSX 10.4: MathJax is really slow for me. – Sam Nead Nov 26 '11 at 16:16

I don't know how you want to do user scripts. I use bookmarklets mostly.

To pause it:

javascript:(function(){MathJax.Hub.queue.pending=1;})();


To turn it back on:

javascript:(function(){MathJax.Hub.queue.pending=0;})();


Presumably something similar can be done with automatic solutions like greasemonkey. The turn-it-back-on does not request an immediate render, but you can add the:

MathJax.Hub.Queue(["Typeset", MathJax.Hub, "wmd-preview"])


to the bookmarklet yourself if you'd like. Turning it back on may cause a delay; if so I can adjust the script to more drastically disable mathjax.

-
I don't know how people normally trade bookmarklets. I just put them at the bottom of my homepage. Just drag the links to the area of the browser right below the addressbar (called the "bookmarks bar") and you have a button. LtT turns it off. MJWMD turns it on. Both only work on stackexchange (or sites using the same markdown processor). – Jack Schmidt Jul 15 '11 at 16:56
Thank you so much! This seems to work the way I wanted it to. Let me try it a bit before I accept your answer. – t.b. Jul 15 '11 at 18:00
That's perfect and works like a charm, you can't even start imagining how much better the site feels to me now. Thanks again! I decided not to accept your answer since I still hope for a feature that allows me to turn this off without resorting to such tricks. – t.b. Jul 16 '11 at 8:56
No problem. MediaWiki (wikipedia etc.) lets you install your own personal javascript on the site (that only loads for you). This is very handy for customizing things. Perhaps something similar will happen for stackexchange. – Jack Schmidt Jul 16 '11 at 14:01
The joy is over already :( they seem to have replaced the postRenderHtmlHook definition by a direct call editorObject.hooks.chain("onPreviewRefresh", function () { MathJax.Hub.Queue(["Typeset", MathJax.Hub, "wmd-preview"]); }); which I don't know how to suppress. – t.b. Jul 17 '11 at 1:57
The new method no longer exposes the markdown converter, but you can tell mathjax to take a break processing its queue. Things still get added to the queue, so this is very friendly, but maybe when you turn the queue back on it will still hang your browser (mine are fine). If this is a problem, let me know since it is easy to (a) disable adding things to the queue, and (b) empty the queue without processing. However, these are a bit more drastic. New script works on any mathjax site. – Jack Schmidt Jul 17 '11 at 9:19
Thank you yet again, your new solution again achieves what I need. Never mind about Greasemonkey, I was simply unaware of the possibility of using bookmarklets in this way. – t.b. Jul 17 '11 at 12:37
I reposted these instructions on MO. Please let me know if something needs modification, and thanks for having provided this solution. – quid Dec 22 '15 at 23:40