Page MenuHomePhabricator

Remove (or improve) hack for integrals from wiki2jax.js
Closed, ResolvedPublic

Description

The ConvertMath function in MathJax/extensions/wiki2jax.js contains a strange hack which should be removed in my opinion, or at least improved and documented properly.

It transforms various hacks used to produce multiple integral signs with a circle to something, which probably should look more nicely. That it doesn't work as expected is shown on http://leuksman.com/mw/index.php/Integral, where the first formula is destroyed. If hacks in TeX produce ugly output, well, then those hacks should be avoided, not other hacks used.


Version: unspecified
Severity: normal
URL: http://leuksman.com/mw/index.php/Integral
See Also:
https://github.com/mathjax/MathJax/issues/566

Details

Reference
bz35477

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:15 AM
bzimport added a project: Math.
bzimport set Reference to bz35477.
bzimport added a subscriber: Unknown Object (MLST).

@Micheal, do you still have that integral example somewhere ?

Related URL: https://gerrit.wikimedia.org/r/61253 (Gerrit Change I1159f6ca33314aa985a44f357c8c4c6ccbc4b188)

(In reply to comment #2)

@Micheal, do you still have that integral example somewhere ?

Sorry, but no. I think it was something like
\iiint\!\!\!\!\!\subset\!\supset x = \iiint\!\!\!\!\!\subset\!\supset x
where the greedy .* removes everything between the two integrals.

mal.malego wrote:

Thanks Michael, I was not aware of this bug. Fixed in https://en.wikipedia.org/w/index.php?title=User%3ANageh%2FmathJax%2Fconfig%2FTeX-AMS-texvc_HTML.js&diff=560211605&oldid=556755207

@DJ: Is this the issue mentioned at https://gerrit.wikimedia.org/r/#/c/61253/ and at my talk page? If not, make sure \oiint and \oiiint are defined as macros in texvc.js. In that case, either will MathJax substitute these commands by their respective characters (STIX fonts) or setupPrefilter (wiki2jax.js) will replace the commands by some lengthy complicated macros that simulate their appearance (TeX fonts).

@Nageh, this is mathjax specific ? We don't have it as part of texvc ?

LaTeX packages providing \oiint and/or \oiiint : mathdesign, wasysym, mathabx, txfonts

http://tug.org/pipermail/texhax/2004-September/002706.html

mal.malego wrote:

Not sure what you mean. MathJax isn't TeX, it only emulates standard (mostly math mode) commands and macros as well as a subset of the widely used AMSsymbols and AMSmath packages (and parts of a few other packages), so we can't include other TeX packages as such. (I guess you knew that.)

\oiint and \oiiint are supported by neither MathJax nor texvc; however, hacks to emulate these symbols are so widespread on en.wiki (see https://en.wikipedia.org/wiki/Help:Latex#.5Coiint_and_.5Coiiint) that I have decided to let mathJax automatically detect these hacks and to either replace them by native symbols (STIX fonts) or to at least fix the visual appearance of these hacks (TeX fonts). In addition, in both cases, what is presented to the reader as TeX code (MathJax menu -> Show Math As -> Tex Commands) is "\oiint" and "\oiiint" rather than the (unreadable) hacks.

It might be a concern if \oiint and \oiiint are supported by mathJax but not by the default texvc implementation. There are two obvious solutions to this: add support for these symbols to MediaWiki's default texvc implementation, or prevent users from directly using the symbols in MathJax (I'd need to think about how to best implement that).

We should not support things in our MathJax mode that are not supported by texvc. (There are a few already and that is a different ticket).

So yes, my idea was to add support for these symbols to texvc, possibly using the esint package (it seems the 'slimmest' package that is adding these symbols.

BTW, however added that advice of the workaround to the page should have just thrown the workaround into a template. This is gonna be a nightmare to 'retroactively' fix.....

Change 61253 abandoned by TheDJ:
Bug 35477: Improve transformations of iint and oiint

Reason:
After consultation with Nageh, this should probably be removed from the MathJax mode.

https://gerrit.wikimedia.org/r/61253

mal.malego wrote:

Hm, my regex code is certainly versatile enough to catch all these hacks and transform them into ordinary symbols. I'm not sure leaving the situation as is is the best idea. Certainly, I would prefer adding oiint and oiiint support to both MathJax and texvc. It would be interesting what others think of this.

mal.malego wrote:

Btw, \oiiint is only supported by txfonts/pxfonts (and mathdesign in a somewhat less pretty shape).

mal.malego wrote:

Oh, and if you remove the code from the MathJax mode then the hacks will look horrible, that is, they will be incompatible between MathJax and texvc. So, even if you do not want to directly support the symbols in MathJax mode the code should still stay - only the symbols should be precluded from directly being used by a user.