# the bug re-appears (Delay when rendering TeX)

The bug that I reported in this question is back today.

${}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}$

• Like Arturo (from the linked question) this is how it has always been for me. I usually compose in notepad and copy it over periodically to make sure it renders. As it is, the textbox for typing an answer is barely functional. – Antonio Vargas Apr 1 '12 at 18:19
• @Antonio The point is that the preview used to work splendidly. It was broken recently - so much so that it makes the site almost unusable for me, since it crashes every browser I have, causing me to lose work, etc. I've had to stop using the site because it is far too painful with all the crashes. – Bill Dubuque Apr 1 '12 at 21:59
• Still there hours later. This is horrible. Last time it got cleared up shortly after the problem began. Now if I've typed part of an answer, I have to stop typing and wait for TeX to get rendered, and then as soon as I start typing again, I just see unrendered code throught the whole answer, and it it doesn't get rendered again until 10 seconds or so after I stop typing. Stackexchange has never been like this (for me...) except during that brief period when I reported this bug earlier. – Michael Hardy Apr 1 '12 at 22:01
• The problem wasn't here yesterday. – Michael Hardy Apr 1 '12 at 22:01
• @Michael Are you talking about the preview crash/freeze bug (as linked), or the quality standard block (or both)? If you refer to the crashes then you should explicitly mention such. Otherwise, readers who don't chase the link may think that you refer only to the far less serious quality standard issue. – Bill Dubuque Apr 1 '12 at 22:06
• @BillDubuque : You wrote "as linked". I don't see any link. – Michael Hardy Apr 1 '12 at 22:20
• @Michael The link you gave as "this question". – Bill Dubuque Apr 1 '12 at 22:28
• @MichaelHardy I think Bill is referring to the link in your question. The way it is written right now it looks like you are talking about the quality standard block that comes up on short questions. (That is what I thought when I read this earlier, and didn't click on the link in your question. I didn't realize what you were actually complaining about until reading the comments.) – user23784 Apr 1 '12 at 22:29
• @Michael Not to mention the paper-clip unicorn that's romping across all of my idle stackexhange screens today... – Bill Dubuque Apr 1 '12 at 22:31
• Using MSE is much more unpleasant than it used to be, with long delays while typing answers. – André Nicolas Apr 2 '12 at 16:06
• The problem continued for a couple of days, and now seems to be gone. – André Nicolas Apr 3 '12 at 17:24

The current preview code in use on MSE no longer has a delay before it starts typesetting the preview, so I do not see how you are having the same issue as you previously reported. Are you saying that there is a significant delay between when you type and when the math starts to be displayed?

The current algorithm is to replace the preview with the new text and immediately start typesetting it, but if new characters are typed, to interrupt the typesetting, replace the preview and start typesetting again.

MathJax does finish the current equation before it can be interrupted, so there is a possible delay there (though it should be small for most equations), and some equations may cause MathJax to load external files (for example, if there is no mathematics on the page already, the first equation to be typeset will cause MathJax to load the input and output processors), and that can cause a delay. But other than that, typesetting should proceed immediately.

But typesetting isn't instantaneous, and (depending on how fast you are typing and how long the answer is), you may interrupt MathJax before any equations are completed, so you may not see typeset equations while you type. But they should show more quickly (and more quickly after you stop typing) than when there was a delay before the typesetting was started. With a short answer having few equations, things should move fast enough that you don't see the untypeset mathematics.

Note that this is how the preview has always worked. In the past, the TeX was re-typeset every time you typed a new character, so your claim that "I could keep typing and still see the displayed $\rm\TeX$ as I typed" is based on the fact that the typesetting completed fast enough for you not to see it happening. When the delay was added (the source for your original complaint), that was no longer the case, and you did have to wait for the math to show up. The difference between the current approach and the older one that you liked is that typing new material now interrupts the typesetting and restarts it on the new material (rather than having to wait for everything to typeset). That should make the preview more responsive to your typing, especially for longer answers, but it does mean that mathematics later in the text might not get typeset as you continue to type.

Just to be clear, it was never the case that previously typeset math was being kept unchanged while you type. It has always been re-typeset for each character.

A better solution would be to update only the portion of the message that has actually changed, and only re-typeset the math in that portion of the text, but that would require a much more sophisticated editor than the one currently in use on SE.

• Hi Davide, thanks for your answer. Am I understanding you correctly that it is normal behavior for TeX to rerender with every new character typed, slowing down text input? When composing an answer, if there is TeX anywhere earlier in the answer I can usually type (non-TeX) faster than it displays. Sometimes it chugs so much that it stops accepting input at all for a split second and ignores a character or two. – Antonio Vargas Apr 2 '12 at 22:05
• Yes, the TeX is retested each time the input changes. Prior to a week ago, all the TeX would be typeset before responding to te next character typed. That is no longer the case. Now typing will interrupt the typesetting, and can even do so before any typesetting occurs, so the preview should be more responsive than it used to be, and you should no longer have to wait as long as you did, or lose characters. Has that happened in the last week? – Davide Cervone Apr 3 '12 at 12:01