Last modified: 2014-10-19 18:19:10 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T37186, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 35186 - MathJax: Several commands that work in texvc are not recognized
MathJax: Several commands that work in texvc are not recognized
Status: ASSIGNED
Product: MediaWiki extensions
Classification: Unclassified
Math (Other open bugs)
unspecified
All All
: Low normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 70207 31406 make-mathjax-default
  Show dependency treegraph
 
Reported: 2012-03-13 08:56 UTC by Michael M.
Modified: 2014-10-19 18:19 UTC (History)
11 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Michael M. 2012-03-13 08:56:57 UTC
I found these:
\varcoppa, \sampi, \varstigma, \Digamma, \Sampi, \euro, \geneuro, \geneuronarrow, \geneurowide, \officialeuro, \arccot, \arcsec, \arccsc, \cancel, \bcancel, \xcancel, \cancelto

Additionally, \color doesn't recognize all color names, at least not OliveGreen:
{ \color{OliveGreen} 1 } is black.
Comment 1 Michael M. 2012-03-13 09:20:30 UTC
For more colors, that don't work, see http://leuksman.com/mw/index.php/Help,_Formula#Color (at least one example where the help from en.wikipedia is better than that from de).
Comment 2 Michael M. 2012-03-14 08:53:48 UTC
The unrecognized colors are rendered black in Firefox 3.6, in IE 8 a [Math Processing Error] is displayed instead.
Comment 3 Brion Vibber 2012-03-14 22:54:33 UTC
Putting this on my list, these should be addable.
Comment 4 Richard Morris 2012-03-15 00:50:04 UTC
\arccot, \arcsec, \arccsc were solved in Nageh version by adding some macros. See http://en.wikipedia.org/wiki/User_talk:Nageh/mathJax#Missing_functions
Comment 5 Michael M. 2012-03-17 08:30:07 UTC
After a closer look at the sources: \color seems to be only a configuration issue, since there is MathJax/extensions/TeX/color.js. Probably you just have to mention it in MathJax/config/TeX-AMS-texvc_HTML.js next to the other extensions.
The missing commands that can be emulated should go in MathJax/extensions/TeX/texvc.js.
Comment 6 Richard Morris 2012-03-25 16:15:13 UTC
<math>\dot \vec u</math> works with tecvc but not with mathjax wihich only accepts the (correct) Latex <math>\dot{\vec u}</math>. There are a few similar bugs mentioned at http://en.wikipedia.org/w/index.php?title=User_talk:Nageh/mathJax including $$\hat \mathbf u$$, $$\underline \mathbb Z$$, $$\hat \boldsymbol \theta$$
Comment 7 Derk-Jan Hartman 2012-03-25 20:38:05 UTC
Added the colors in https://gerrit.wikimedia.org/r/3723
Comment 8 Derk-Jan Hartman 2012-03-25 22:13:46 UTC
Seems pagecolor is also not supported yet.
Comment 9 Derk-Jan Hartman 2012-03-25 22:21:39 UTC
\cancel, \bcancel, \xcancel, \cancelto can also be enabled by adding the extension to our config.
Comment 10 Derk-Jan Hartman 2012-03-26 21:39:23 UTC
\arccot, \arcsec, \arccsc: https://gerrit.wikimedia.org/r/3767 
\cancel, \bcancel, \xcancel, \cancelto: https://gerrit.wikimedia.org/r/3768
Comment 11 Derk-Jan Hartman 2012-03-26 22:33:05 UTC
Our defined symbols are smaller than the symbols from the AMS package due to different styling.

Our symbols get <code>font-family: STIXGeneral, 'Arial Unicode MS', serif; font-size: 85%; font-style: italic; font-weight: normal;</code>, whereas AMS symbols only get <code>font-family: MathJax_AMS;</code>

this will need fixing at some point.
Comment 12 Michael M. 2012-03-28 08:58:20 UTC
From source code I extracted lists of both the commands allowed in texvc and MathJax, and diffed them. I hope this is the complete list of commands still missing:

AA
Dagger
Digamma
emph
euro
geneuro
geneuronarrow
geneurowide
H
image
officialeuro
pagecolor
Q
sampi
Sampi
sen
textsf
texttt
varcoppa
varstigma
vbox
vline
Comment 13 Derk-Jan Hartman 2012-04-01 14:16:03 UTC
Added in https://gerrit.wikimedia.org/r/4060
\Dagger
\Digamma
\sampi
\Sampi
\varcoppa
\varstigma
\Q U+0051  doublestruck Q
\H  U+8461 doublestruck H
\AA  U+00C5 armstrong
\sen  spanish version of \sin (bug 18912)
\image alias for \Im



Still left:
\euro
\geneuro
\geneuronarrow
\geneurowide
\officialeuro


\pagecolor  ignore


Text instead of math formatting.. should we really include this ?
\emph{}   text emphasize (italics)
\textsf{}   text sans serif
\texttt{}   text typewriter
\vbox{text} Encloses a paragraph's text to prevent it from running over a page break
\vline         draws a vertical line with the height of the row at the location where it appears
Comment 14 nageh 2012-04-18 11:58:07 UTC
\textsf{}, \texttt{} and \vline are implemented https://en.wikipedia.org/w/index.php?title=User%3ANageh%2FmathJax%2Fconfig%2FTeX-AMS-texvc_HTML.js&diff=486528289&oldid=485202027 here. \emph{}, while implemented as \textit{}, really shouldn't be supported because it is a text mode command and not a math mode command.

The case with the euro symbols is a different one. The \gen* commands are supposed to be generated from the 'C' letter, meant to support symbols that more closely match the font style. However, it turns out that Unicode and font designers, instead of adopting the official euro symbol, have preferred a symbol that matches the font style. Which means that the euro symbol in the font set most closely resembles \geneuro. \officialeuro is not available in the fonts, unless a specific euro font file will be added to MathJax. \euro is a link to one of the other symbols; while set to \officialeuro by default I have linked it to \geneuro.
Comment 15 nageh 2012-04-18 12:07:03 UTC
This change, https://en.wikipedia.org/w/index.php?title=User%3ANageh%2FmathJax%2Fconfig%2FTeX-AMS-texvc_HTML.js&diff=486653054&oldid=486652453, adds the RGB color space so \definecolor does not fail anymore.

This change, https://en.wikipedia.org/w/index.php?title=User%3ANageh%2FmathJax%2Fconfig%2FTeX-AMS-texvc_HTML.js&diff=486652319&oldid=486638683, removes the noErrors.js extension, which, don't ask me why I have included it.

This change, https://en.wikipedia.org/w/index.php?title=User%3ANageh%2FmathJax%2Fconfig%2FTeX-AMS-texvc_HTML.js&diff=486638683&oldid=486528289, implements pretty perfect \oiint support for both HTML-CSS and MathML output, and admittedly a (still) imperfect implementation of \oiiint. I possibly would be good to directly rely on the font symbols when STIX fonts are detected.

This change, https://en.wikipedia.org/w/index.php?title=User%3ANageh%2FmathJax%2Fconfig%2FTeX-AMS-texvc_HTML.js&diff=487586044&oldid=486653054, resolves an issue where the \scriptstyle hack, which is so common on Wikipedia to effect a normal font size, is used in boxed display maths. I have updated my documentation accordingly (here: https://en.wikipedia.org/wiki/User:Nageh/mathJax#Usage_notes).
Comment 16 nageh 2012-04-18 12:11:44 UTC
This change, https://en.wikipedia.org/w/index.php?title=User%3ANageh%2FmathJax.js&diff=484537614&oldid=484068957, supports mtextFontInherit for both HTML-CSS and MathML output.

Someone has complained that the vertical margin for display maths is too large. This change, https://en.wikipedia.org/w/index.php?title=User%3ANageh%2FmathJax.js&diff=487684008&oldid=486653976, reduces that margin by a tiny bit. I think it pretty closely matches that of ordinary LaTeX.
Comment 17 wikimedia.x.0x 2012-05-04 06:53:19 UTC
So stuff like \texttt won't be supported? Should sites using these therefore be changed? Example: http://de.wikipedia.org/wiki/Lyndonwort
Comment 18 nageh 2012-05-04 11:20:54 UTC
Huh? \texttt is most likely to be supported as it can be trivially implemented. See comment 14.
Comment 19 Richard Morris 2012-05-04 11:24:34 UTC
As nageh has said \texttt \textsf and \emph can probably be fixed by adding
MathJax.Hub.Config({
  TeX: {
    Macros: { 
      texttt:             ['Macro','\\mathord{\\tt{\\text{#1}}}',1],
      textsf:             ['Macro','\\mathord{\\sf{\\text{#1}}}',1],
      emph:               ['Macro','\\textit{#1}',1],  // doesn't switch to \textrm within italic text as it should
    }
  }
}
although I'm not sure if it works for doubly nested items (which don't actually work for \textbf{\textit{broken}} anyway).
Comment 20 nageh 2012-05-04 20:48:50 UTC
Oh? I didn't know that \text doesn't accept nested commands. I suppose this could be easily fixed by the MathJax devs. Do you want to file a bug report at https://github.com/mathjax/MathJax/ ? Should I file one on your behalf? Thanks.
Comment 21 nageh 2012-05-05 11:44:23 UTC
That should be https://github.com/mathjax/MathJax/issues .
Comment 22 Richard Morris 2012-05-06 05:56:54 UTC
Now not convinced \textbf{\textit{broken}} is broken I can't see anywhere in latex doc which say the \textfoo commands should nest. Only source which indicates it is seems to be http://en.wikibooks.org/wiki/LaTeX/Text_Formatting which isn't that reliable.
Comment 23 nageh 2012-05-06 10:45:58 UTC
Did you search on Google books? You could also try it yourself using your favorite LaTeX2e interpreter. \text* commands have been introduced in LaTeX(2e) over TeX for two reasons: old commands (\bf, \it, etc.) don't take a parameter so you always have to write {\bf text}; and they don't nest in contrast to \text*.
Comment 24 nageh 2012-05-06 11:23:16 UTC
CTAN is the definite web source for information on LaTeX and packages. You may want to read the top of page 124 of http://ctan.org/tex-archive/info/lshort/english/lshort.pdf
Comment 25 nageh 2012-05-09 15:40:34 UTC
Now reported at https://github.com/mathjax/MathJax/issues/243 .
Comment 26 Liangent 2012-08-07 15:42:45 UTC
\theta = 5^\operatorname{\omicron}

This math code is problematic but I dunno which command is the cause.
Comment 27 Richard Morris 2012-08-07 16:18:37 UTC
An extra pair of curly brackets sorts it out. <math>\theta = 5^{\operatorname{\omicron}}</math> works.  MathJax is a bit more particular with precedence than texvc.
Comment 28 Liangent 2012-08-07 16:28:33 UTC
(In reply to comment #27)
> An extra pair of curly brackets sorts it out. <math>\theta =
> 5^{\operatorname{\omicron}}</math> works.  MathJax is a bit more particular
> with precedence than texvc.

This is still some inconsistency...
Comment 29 Michael M. 2012-08-20 09:06:02 UTC
(In reply to comment #27)
> An extra pair of curly brackets sorts it out. <math>\theta =
> 5^{\operatorname{\omicron}}</math> works.  MathJax is a bit more particular
> with precedence than texvc.

This is reported in bug 36534.
Comment 30 Gerrit Notification Bot 2013-04-28 12:13:47 UTC
Related URL: https://gerrit.wikimedia.org/r/61256 (Gerrit Change If6573901bafd8599a01979bcbff89e52b51e4ffd)
Comment 31 Gerrit Notification Bot 2013-04-28 23:09:45 UTC
Related URL: https://gerrit.wikimedia.org/r/61287 (Gerrit Change If38014bde908bb202dc63213fa21a72b52a6a42d)
Comment 32 Derk-Jan Hartman 2013-04-28 23:18:14 UTC
Still to do of things discussed in this ticket:

Revive: https://gerrit.wikimedia.org/r/4060

the euro symbols

\emph (only works if not in italics mode)
\vbox


https://en.wikipedia.org/w/index.php?title=User%3ANageh%2FmathJax.js&diff=484537614&oldid=484068957
Would like to know if it was intentional here that Nageh has changed the CSS to only affect MathML mtext elements (and no longer the HTML-CSS class .mtext)

https://en.wikipedia.org/w/index.php?title=User%3ANageh%2FmathJax.js&diff=484537614&oldid=484068957
Comment 33 nageh 2013-04-30 13:08:30 UTC
DJ, you are right in your assumption that "mtext" targets MathML elements rather than the standard HTML/CSS output. For the latter, the "mtextFontInherit" property  is being used, which has become available since MathJax version 2.0.
Comment 34 nageh 2013-04-30 13:43:46 UTC
I shall add that the mtext font scaling to 80% is almost certainly not correct, however, if omitted Firefox does not adapt the font size to that of the surrounding text (which is scaled to 80% by default). As MathML support has become available on Chrome, which correctly implements the scaling, I would suggest removing that part from the mtext CSS definition, i.e., simply use

styles: { "mtext": { "font-family": "sans-serif ! important" } }
Comment 35 Peter Krautzberger 2013-04-30 15:12:19 UTC
Hi nageh,

MathJax can be configured to scale differently per browser. But it shouldn't have to be scaled at all (except for personal preference), so if you can produce a bug report, we'd appreciate it. https://github.com/mathjax/mathjax/issues

Oh, also: Chrome is currently removing the MathML code in Blink; the Chrome devs have hinted at a complete re-write. So MathML in Chrome is probably dead for the foreseeable future.

Peter.
Comment 36 nageh 2013-04-30 16:08:32 UTC
Hi Peter,

thank you for your input. Yes, scaling should not be needed at all, and I was actually just going to suggest to ignore that custom styling altogether (there is no point in introducing something that breaks on one or the other browser). I will file a bug report.

Interesting note on Chrome's MathML support. What a pity.
Comment 37 nageh 2013-05-02 11:36:19 UTC
As for \textsf and \texttt, these commands are correctly being defined but are missing styling support in the HTML/CSS output jax of TeX-AMS-texvc HTML.js when mtextFontInherit is being enabled.

This is fixed by amending the source with matches for "monospace" and "sans-serif" font variants. In explanation, you'll find code statements like

if(!j.weight&&j.mathvariant.match(/bold/)){j.weight="bold"}

Replicate these for the other font variants. I may do so in my user script sources so you can copy the changes. But possibly this would be a useful change for the official MathJax sources as well... Peter, what do you think?
Comment 38 Derk-Jan Hartman 2013-05-02 13:07:01 UTC
Nageh, ah, I was wondering why \texttt and \textsf weren't working for me indeed.
Comment 39 Derk-Jan Hartman 2013-05-02 14:08:09 UTC
@Nageh, sounds like a follow up of https://github.com/mathjax/MathJax/issues/226 right ? that \sf \tt fontinherit issue ?
Comment 40 nageh 2013-05-02 15:21:02 UTC
Yes, indeed, the same solution is needed to fix \sf and \tt.
Comment 41 Peter Krautzberger 2013-05-02 15:43:40 UTC
yes, this sounds like a bug in MathJax.
Comment 42 Derk-Jan Hartman 2013-05-14 07:47:05 UTC
upstream: https://github.com/mathjax/MathJax/issues/459
Comment 43 Gerrit Notification Bot 2013-05-19 17:15:17 UTC
https://gerrit.wikimedia.org/r/4060 (Gerrit Change I51a72c378d3496b147eb87418c24718026306c13) | change RESTORED [by TheDJ]
Comment 44 Gerrit Notification Bot 2013-05-19 18:06:53 UTC
Related URL: https://gerrit.wikimedia.org/r/64530 (Gerrit Change I20ac8af2253835c20431585d9caebe4066606879)
Comment 45 Gerrit Notification Bot 2013-05-19 18:13:41 UTC
Related URL: https://gerrit.wikimedia.org/r/64531 (Gerrit Change If2fb219a1191caeecb0ed04bf0c0105621725dce)
Comment 46 physikerwelt 2013-10-22 19:17:10 UTC
https://gerrit.wikimedia.org/r/#/c/90748/
This solves all the issues since it passes only real TeX to MathJax.
I home someone will review this one day.
I even wrote a guide how to verify the correctness of the change.
http://www.formulasearchengine.com/Verify%20texvc%20light

Even that did not help...
Maybe I should add some wrong spacing so that potential reviewers find something to comment.
Comment 47 Richard Morris 2014-03-11 14:13:41 UTC
The treatment of \color is very different between the two versions. 
Looking at 
http://docs.mathjax.org/en/latest/tex.html#color
we see
"The \color command in the core TeX input jax is not standard in that it takes the mathematics to be colored as one of its parameters, whereas the LaTeX \color command is a switch that changes the color of everything that follows it."

This means in texvc we have
   <math>foo \color{Red} Red text \color{Black} bar</math>
which breaks mathjax. 

You can fix things so that
   <math>foo {\color{Red}{Red text}} bar</math>
which seems to work with both mathjax and also texvc. Note it needs the text to be colored in { } so mathjax recognises the first argument, and also { } around the whole thing so texvc does not get confused.

A further issue is the colors supported. LaTeX's colors are

Apricot	Aquamarine	Bittersweet	Black
Blue	BlueGreen	BlueViolet	BrickRed 
etc

But MathJax only support colors with CSS names. So no Apricot, Bittersweet, BlueGreen or BrickRed. You can see the difference by viewing 
https://en.wikipedia.org/wiki/Help:Formula#Color
with the different renderers.

There is MathJax color.js extension. Which makes the color handling like the texvc and I think define latex rather than CSS colors. It might be worth installing.
Comment 48 Derk-Jan Hartman 2014-04-05 16:09:48 UTC
@Richard The color problems were introduced in late january: Bug 63574. It's just that nobody noticed until today.

Please try to open separate tickets for separate issues. Link them with dependencies if you want to group them.
Comment 49 nageh 2014-04-06 11:34:46 UTC
Oddly enough it seems that I was the first to notice despite I'm not being active anymore.
Comment 50 Gerrit Notification Bot 2014-10-12 15:13:01 UTC
Change 4060 abandoned by Physikerwelt:
Math: Adding archaic greek symbols from teubner set

Reason:
conserved in https://www.mediawiki.org/wiki/Extension:Math/Roadmap#Bugs_and_Roadmap_and_random_thoughts_.28From_the_discussion_page.29 feel free to restore if any development on that is planned

https://gerrit.wikimedia.org/r/4060
Comment 51 physikerwelt 2014-10-19 18:18:30 UTC
This should be fixed within MathJax. I discussed with Peter that we don't want to have a WMF specific version of MathJax to reduce the maintenance effort.
See https://github.com/mathjax/MathJax/pull/882

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links