# MathJax renders badly when editing from Review Queue

This has been plaguing me for some time, and I wish I'd asked about it before.

I often try to "fix" math formatting for new users when I come across their posts in the Review Queue, posing hard to read but decipherable problems. As an example, see this item.

While editing to supply the {cases} syntax, something I'd expect beginners would have difficulty parsing out for themselves from the help page, I found that the preview rendering was balky and incomplete. Balky is understandable, but even when the MathJax renderer caught up, the preview was incomplete in that all the cases were strung out on a single line.

Indeed when I think back over other difficulties I've encountered, improper (missing) rendering of "line breaks" qua \\ has been one of the recurring issues. Once the edit was submitted, the revised Question displayed as expected. Before submission the effect might be similar to this previously reported issue with the {pmatrix} syntax.

Could there be something special about MathJax rendering in the Review/Edit gestalt (or in the editing vs. composing gestalt more generally) that is bugging me??

• The missing line breaks in review might be caused by a bug in SOUP, if you're using it. I'll try to fix that ASAP. – Ilmari Karonen Nov 30 '17 at 6:39
• It turns out that, in fact, MathJax preview often fails to work at all when editing from review. For the sake of clarity, I've reported that as a separate bug. – Ilmari Karonen Nov 30 '17 at 13:40

Perhaps the best way to reproduce the problem is by posting some of the problematic expressions in a CW-answer, and inviting the Community to edit them and Comment on their experiences. Since the edits themselves exhibit the preview behavior, it's probably unnecessary to save edits (unless one wishes to add new examples).

First is a "cases" expression, taken from the linked item above (as I revised it):

The following is said to be a cumulative distribution function for random variable $X$:

$$F_X(x) = \begin{cases} 0, & \text{if } x\lt 0 \\ 0.5x, & \text{if } 0\le x\lt 1 \\ x-0.5, & \text{if } 1\le x\lt 1.5 \\ 1, & \text{if } x\ge 1.5 \end{cases}$$

Second is a simple use of "\\" as line break in display mode, taken from another recent revision "for clarity":

$$(3 \space times / 1 \space pie) \cdot (1 \space pie / 1000 \space cal) \cdot (500 \space cal / 1 \space hr) \cdot \\ (2 \space hr / 1 \space essay) \cdot (3 \space essays / 1 \space app) \cdot (3 \space app / 1 \space acceptance) \cdot 10 \space acceptances$$

I'll add a couple of additional "suspect" uses of the line break syntax (for matrices, and for the align environment).

Umm, yeah... that was probably my fault. At least some of it.

What happened was that, about a year and a half ago, I added a client-side fix that disables display math in question lists into my SOUP user script. And I set up that script so that it applied to any MathJax content inside any HTML element with the class summary, which is used in question lists and search results.

What I didn't realize is that, apparently, that same class name is also used in a bunch of other places in the SE interface, too. One of those places happened to be suggested edit review. So, basically, if you has SOUP installed it would force any display math in suggested edits to render inline. And if you tried to improve the suggested edit (or to reject it and edit the post yourself instead), any display math in the edit preview pane would also be forced inline.

Anyway, I've just pushed an updated version of SOUP (v1.48.4) that should hopefully fix this issue to GitHub. I'll also upload the updated version to Firefox Add-ons and Google Web Store, for people using the stand-alone extension version of SOUP.

(The slow / missing MathJax rendering when editing from review looks like a different issue, though. I don't think it has anything to do with SOUP, since I can reproduce it even with all user scripts and extensions disabled. The symptoms I'm seeing look vaguely similar to this old MathJax preview bug, although in this case there's nothing logged to the console.)

• Thanks for the investigation. I'm not a SOUP user, but as you've otherwise built cases to reproduce problems, this will advance the diagnosis. – hardmath Nov 30 '17 at 14:24