8
\$\begingroup\$

In an attempt to edit the tag wiki of I noticed the following strange behaviour.

The conjecture is often stated as a definition by cases and even serves as an example for that notation in the mother of all MathJax demos. I tried to apply that to the tag wiki, by modifying its code to that:

$$
a_{i+1} =\begin{cases}
\frac{a_i}{2} & \text{if $a_i$ is even}\\[2ex]
3 a_i + 1 & \text{if $a_i$ is odd}
\end{cases}
$$

Which renders just fine here:

$$ a_{i+1} =\begin{cases} \frac{a_i}{2} & \text{if $a_i$ is even}\\[2ex] 3 a_i + 1 & \text{if $a_i$ is odd} \end{cases} $$

However, in the tag wiki, not so much:

enter image description here

As can be seen by the output, there seems to be a problem with the newline which is not interpreted as such. I added the test case

$$
a\\b
$$

which also renders properly outside tag wikis:

$$ a\\b $$

The fact that the above behaviour is only present in the tag wiki makes me suspect that it's a bug. Of course, pebkac is always an option and this might be expected behaviour/by design/my fault. Either way, can somebody please explain this?

\$\endgroup\$
3
  • \$\begingroup\$ that's peculiar ... Could it be related to the fact that in standard LaTeX the \[ is used to start a new math block? At least it seems to choke on that ... \$\endgroup\$
    – Vogel612
    Commented Oct 8, 2016 at 22:27
  • \$\begingroup\$ @Vogel612 I had tried it without the additional spacing information (that is the [2ex] for those that don't know), but that didn't work either. Also, the a\\b test case hints at the problem being somewhere else. However, your comment let me start a bit more experimenting and I could reproduce, the problem outside the tag wiki, will post that as an answer for now. \$\endgroup\$ Commented Oct 8, 2016 at 22:33
  • \$\begingroup\$ flagged: It's been almost a month now and there is no answer from the people in charge whatsoever. No confirmation if this is a bug or not, if somebody is working on it, if it is of too low priority to be fixed now, etc. I hoped providing the results of my own investigations would help solve the problem quickly. This was apparently not the case. \$\endgroup\$ Commented Nov 6, 2016 at 19:41

2 Answers 2

4
\$\begingroup\$

I managed to reproduce the problem outside the tag wiki.

If one takes the regularly working code:

$$
a_{i+1} =\begin{cases}
\frac{a_i}{2} & \text{if $a_i$ is even}\\[2ex]
3 a_i + 1 & \text{if $a_i$ is odd}
\end{cases}
$$

$$ a_{i+1} =\begin{cases} \frac{a_i}{2} & \text{if $a_i$ is even}\\[2ex] 3 a_i + 1 & \text{if $a_i$ is odd} \end{cases} $$

and removes one backslash:

$$
a_{i+1} =\begin{cases}
\frac{a_i}{2} & \text{if $a_i$ is even}\[2ex]
3 a_i + 1 & \text{if $a_i$ is odd}
\end{cases}
$$

$$ a_{i+1} =\begin{cases} \frac{a_i}{2} & \text{if $a_i$ is even}\[2ex] 3 a_i + 1 & \text{if $a_i$ is odd} \end{cases} $$

the result looks the same as with two backslashes in the tag wiki. I suspect that some process somehow swallows backslashes, before the input is parsed by the mathjax engine.

Please be careful brave stackexchange developers, the backslash swallowing monster is loose!

On a more serious note, merely removing a backslash from the second test case

$$
a\b
$$

$$ a\b $$

creates a visible error (stuff showing up in red) on the output.

This is different from the output seen in the screenshot in the question, where the a b test case renders without error, but also without the newline.

To reproduce that, one has to insert an additional space:

$$
a\ b
$$

$$ a\ b $$

et voilà, the newline goes missing, without any visible error.

I suspect that the aforementioned process not only swallows backslashes but produces additional spaces as a result.

Beware! It's the attack of the backslash-swallowing-space-pooping mathjax monster. Fly, you fools!

On another more serious note, could somebody with more insights on the code please tame the beast?

\$\endgroup\$
0
\$\begingroup\$

You were right about it swallowing backslashes. You need to use a real real backslash:

$$a\\\b$$

\$\endgroup\$
1

You must log in to answer this question.

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