8
$\begingroup$

I have been writing (and editing) a number of longer posts¹ with a lot of maths in them lately. Sadly, whenever you change a single character, the whole preview is reset which in particular means that all math has to be retypeset. This is annoying (everything reflows!) and a real bummer on slower machines (think netbooks, tablets, ...); when I edit a longer post I have to wait several seconds (>10s have happened) before I can check wether the syntax was good.

With the techniques shown here it should be possible to let MathJax redo only single paragraphs; that would already be a huge help. In principle, it should be easy to split preview input by paragraphs and only reparse (and mathify) those that changed. Please (have tech) look into this.

Please advise wether I have to take this to meta.SO.


¹ Side-by-side and/or selective preview would be cool, too, but that is for another day.

$\endgroup$
5
  • $\begingroup$ What browser are you using? I found older (3.x) versions of Firefox to be especially slow at MathJax (worse than IE of similar vintage), and recent versions of Chrome to be the fastest. $\endgroup$ Apr 1, 2012 at 22:12
  • 2
    $\begingroup$ Posting on a child meta is absolutely fine. $\endgroup$ Apr 1, 2012 at 22:14
  • $\begingroup$ This should probably be tagged as support. $\endgroup$
    – Kaveh
    Apr 2, 2012 at 5:07
  • $\begingroup$ @Gilles: Firefox 10. Atom N270, though. $\endgroup$
    – Raphael
    Apr 2, 2012 at 5:49
  • $\begingroup$ Still in issue with FF 26 and Atom D525. $\endgroup$
    – Raphael
    Jan 15, 2014 at 7:45

1 Answer 1

3
$\begingroup$

Because the math can include things like \def, \label, \ref, etc., it turns out to be a more complex process to do incremental updates than you might think. I did a version of it here, but I don't think it works any more (hooking into the SE editor was fragile, and I think the code has changed since I wrote the userscript, and it no longer is able to hook in properly).

Note that even this approach was not sophisticated enough, as things like bullet lists and such need to be broken down further, so it is not just a matter of breaking into paragraphs (as you suggest, and as I implemented back then).

So while this approach is possible, it adds considerable complexity to the editor code, and I don't think there is much interest in that within the SE development community.

$\endgroup$
2
  • $\begingroup$ Huh, I did not think about definitions. One approximation would be to only recompile locally if there are not such commands on the page (probably the usual case). As an alternative, one could only recompile from the definition downwards. I agree that this adds a new dimension, though. (Dealing with lists seems to be a more technical issue that is easily solved, conceptually.) $\endgroup$
    – Raphael
    Jan 20, 2014 at 9:17
  • $\begingroup$ Yes, typesetting from the definition onwards works (and my code sample does that). Dealing with \label and \ref is more complicated, as references can precede their use. Yes, the lists can be certainly be handled -- I only included it to indicate that breaking into paragraphs is not enough, and that doing this properly takes a more complex approach. $\endgroup$ Jan 20, 2014 at 13:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .