# Description

I noticed a bug in MediaWiki's MathJax implementation:

When using "\ " to produce some spacing at the end of a formula this only works in front of e.g. dots or commas, but not in front of colons, semicolons or exclamation marks (those were the cases I tested)

Examples (working):
$x\ .$
$x\ ,$

Examples (NOT working):
$x\ :$
$x\ ;$
$x\ !$

I tested these TeX commands in LaTeX as well as the online demo of MathJax and it works in both of them, so it seems to be a problem in MediaWiki's implementation of MathJax (or only solved recently in MathJax itself, so the fix didn't make it yet into MediaWiki's code, English Wikipedia is using version 1.22wmf5 (43f93b2) at the time of this writing).

Version: master
Severity: normal

# Details

Reference
bz49210

### Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 1:52 AM
bzimport set Reference to bz49210.
bzimport added a subscriber: Unknown Object (MLST).
Patrick87 created this task.Jun 5 2013, 8:45 PM

Maybe I should mention that a red backslash is shown in the not working cases instead of producing whitespace.

fredw added a comment.Sep 10 2013, 1:57 PM

So the "working" cases seem to produce a space while the "non-working" cases produces a no-break space &#160;. That can be fixed easily by adding a .replace(/\u00A0/g," ") in ConvertMath of wiki2jax, or making the PHP output a space or by fixing bug 35479 and removing the wiki2jax processor.

Pkra added a comment.Feb 10 2014, 1:56 PM

@Physikerwelt have you tried what Fred Wang suggested above? (Or do you need a volunteer to code it so that you can land it?)

This is a bad interaction between the math extension (or perhaps MediaWiki more generally, I don't know) and MathJax "bug" 377.

MediaWiki converts $x\ :$ to $x\&nbsp; :$. While MathJax tolerates &nbsp; in TeX source code, it interprets "\&nbsp;" a TeX command -- invisible hilarity ensues...

You could argue that if MathJax considers &nbsp; a space, then it should tolerate \&nbsp; as well. I'll raise this on our issue tracker (I've reopened the bug).

Peter.

Pkra added a comment.Feb 19 2014, 3:44 PM

There will be a fix for this in the next MathJax version, see https://github.com/mathjax/MathJax/issues/377

physik wrote:

I'll provide a guide how to cherry pick patches from MathJax to Wikipedia.

Well, it was basically a MathJax bug, but that seems fixed, too (so the bug is really resolved).