MathJax: Several commands that work in texvc are not recognized
Closed, DeclinedPublic


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.

Version: unspecified
Severity: normal
See Also:

bzimport set Reference to bz35186.
bzimport added a subscriber: Unknown Object (MLST).
Schnark created this task.Mar 13 2012, 8:56 AM

For more colors, that don't work, see,_Formula#Color (at least one example where the help from en.wikipedia is better than that from de).

The unrecognized colors are rendered black in Firefox 3.6, in IE 8 a [Math Processing Error] is displayed instead.

Putting this on my list, these should be addable.

\arccot, \arcsec, \arccsc were solved in Nageh version by adding some macros. See

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.

<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 including $$\hat \mathbf u$$, $$\underline \mathbb Z$$, $$\hat \boldsymbol \theta$$

Seems pagecolor is also not supported yet.

\cancel, \bcancel, \xcancel, \cancelto can also be enabled by adding the extension to our config.

TheDJ added a comment.Mar 26 2012, 9:39 PM

\arccot, \arcsec, \arccsc:
\cancel, \bcancel, \xcancel, \cancelto:

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.

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:


TheDJ added a comment.Apr 1 2012, 2:16 PM

Added in
\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:

\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

mal.malego wrote:

\textsf{}, \texttt{} and \vline are implemented 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.

mal.malego wrote:

This change,, adds the RGB color space so \definecolor does not fail anymore.

This change,, removes the noErrors.js extension, which, don't ask me why I have included it.

This change,, 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,, 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:

mal.malego wrote:

This change,, supports mtextFontInherit for both HTML-CSS and MathML output.

Someone has complained that the vertical margin for display maths is too large. This change,, reduces that margin by a tiny bit. I think it pretty closely matches that of ordinary LaTeX.

wikimedia.x.0x wrote:

So stuff like \texttt won't be supported? Should sites using these therefore be changed? Example:

mal.malego wrote:

Huh? \texttt is most likely to be supported as it can be trivially implemented. See comment 14.

As nageh has said \texttt \textsf and \emph can probably be fixed by adding

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).

mal.malego wrote:

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 ? Should I file one on your behalf? Thanks.

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 which isn't that reliable.

mal.malego wrote:

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*.

mal.malego wrote:

CTAN is the definite web source for information on LaTeX and packages. You may want to read the top of page 124 of

\theta = 5^\operatorname{\omicron}

This math code is problematic but I dunno which command is the cause.

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.

(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...

(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.

Related URL: (Gerrit Change If6573901bafd8599a01979bcbff89e52b51e4ffd)

Related URL: (Gerrit Change If38014bde908bb202dc63213fa21a72b52a6a42d)

Still to do of things discussed in this ticket:


the euro symbols

\emph (only works if not in italics mode)
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)

mal.malego wrote:

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.

mal.malego wrote:

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" } }

Pkra added a comment.Apr 30 2013, 3:12 PM

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.

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.


mal.malego wrote:

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.

mal.malego wrote:

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


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?

TheDJ added a comment.May 2 2013, 1:07 PM

Nageh, ah, I was wondering why \texttt and \textsf weren't working for me indeed.

TheDJ added a comment.May 2 2013, 2:08 PM

@Nageh, sounds like a follow up of right ? that \sf \tt fontinherit issue ?

mal.malego wrote:

Yes, indeed, the same solution is needed to fix \sf and \tt.

Pkra added a comment.May 2 2013, 3:43 PM

yes, this sounds like a bug in MathJax. (Gerrit Change I51a72c378d3496b147eb87418c24718026306c13) | change RESTORED [by TheDJ]

Related URL: (Gerrit Change I20ac8af2253835c20431585d9caebe4066606879)

Related URL: (Gerrit Change If2fb219a1191caeecb0ed04bf0c0105621725dce)

physik wrote:
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.

Even that did not help...
Maybe I should add some wrong spacing so that potential reviewers find something to comment.

The treatment of \color is very different between the two versions.
Looking at
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

But MathJax only support colors with CSS names. So no Apricot, Bittersweet, BlueGreen or BrickRed. You can see the difference by viewing
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.

TheDJ added a comment.Apr 5 2014, 4:09 PM

@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.

mal.malego wrote:

Oddly enough it seems that I was the first to notice despite I'm not being active anymore.

Change 4060 abandoned by Physikerwelt:
Math: Adding archaic greek symbols from teubner set

conserved in feel free to restore if any development on that is planned

physik wrote:

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.

physik wrote:

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.

That branch was deleted, are the commits preserved or continuing somewhere?

Physikerwelt added a subscriber: Physikerwelt.EditedApr 24 2015, 4:09 PM

No that was not possible due to licensing issues.
But an alternative solution was found
which made it into standard MathJax... so in principal there is no need for any server side support for mediawiki specific customization of MathJax outside from the official MathJax/MathJax repository

Ok. Is the mediawiki-texvc.js extension already in use on Wikimedia projects?

No. Not directly. But I have hope that
will make progress and mathoid will be updated.
Afterwards the MathJax client side option can be removed.
I think using source rendering in connection with a MathJax browser plugin would be a better solution.
Maintaining a MediaWiki specific clone of MathJax does not sound reasonable to me, especially given the fact that the MathJax and MediaWiki resource loader are not compatible.

@Physikerwelt, if the mediawiki-texvc.js extension has already been written, wouldn't using it become a quick fix for this task? Why is it necessary to maintain a MediaWiki specific clone of MathJax?

The extension has been written for MathJax 2.5. Client Side MathJax was updated last time to MathJax 2.3.
The resource loader issue makes it difficult to update the MathJax version.
I think a better aproach would be to use a browser plugin such as

Physikerwelt closed this task as "Declined".Jul 19 2015, 10:38 PM
Physikerwelt claimed this task.

MathJax will be removed T99369

Add Comment