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

Description

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:
https://bugzilla.wikimedia.org/show_bug.cgi?id=35481

bzimport added a project: Math.Via ConduitNov 22 2014, 12:16 AM
bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz35186.
Schnark created this task.Via LegacyMar 13 2012, 8:56 AM
Schnark added a comment.Via ConduitMar 13 2012, 9:20 AM

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

Schnark added a comment.Via ConduitMar 14 2012, 8:53 AM

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

brion added a comment.Via ConduitMar 14 2012, 10:54 PM

Putting this on my list, these should be addable.

SalixAlba added a comment.Via ConduitMar 15 2012, 12:50 AM

\arccot, \arcsec, \arccsc were solved in Nageh version by adding some macros. See http://en.wikipedia.org/wiki/User_talk:Nageh/mathJax#Missing_functions

Schnark added a comment.Via ConduitMar 17 2012, 8:30 AM

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.

SalixAlba added a comment.Via ConduitMar 25 2012, 4:15 PM

<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$$

TheDJ added a comment.Via ConduitMar 25 2012, 8:38 PM
TheDJ added a comment.Via ConduitMar 25 2012, 10:13 PM

Seems pagecolor is also not supported yet.

TheDJ added a comment.Via ConduitMar 25 2012, 10:21 PM

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

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

\arccot, \arcsec, \arccsc: https://gerrit.wikimedia.org/r/3767
\cancel, \bcancel, \xcancel, \cancelto: https://gerrit.wikimedia.org/r/3768

TheDJ added a comment.Via ConduitMar 26 2012, 10:33 PM

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.

Schnark added a comment.Via ConduitMar 28 2012, 8:58 AM

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

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

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

bzimport added a comment.Via ConduitApr 18 2012, 11:58 AM

mal.malego wrote:

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

bzimport added a comment.Via ConduitApr 18 2012, 12:07 PM

mal.malego wrote:

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

bzimport added a comment.Via ConduitApr 18 2012, 12:11 PM

mal.malego wrote:

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.

bzimport added a comment.Via ConduitMay 4 2012, 6:53 AM

wikimedia.x.0x wrote:

So stuff like \texttt won't be supported? Should sites using these therefore be changed? Example: http://de.wikipedia.org/wiki/Lyndonwort

bzimport added a comment.Via ConduitMay 4 2012, 11:20 AM

mal.malego wrote:

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

SalixAlba added a comment.Via ConduitMay 4 2012, 11:24 AM

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

bzimport added a comment.Via ConduitMay 4 2012, 8:48 PM

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 https://github.com/mathjax/MathJax/ ? Should I file one on your behalf? Thanks.

bzimport added a comment.Via ConduitMay 5 2012, 11:44 AM

mal.malego wrote:

That should be https://github.com/mathjax/MathJax/issues .

SalixAlba added a comment.Via ConduitMay 6 2012, 5:56 AM

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.

bzimport added a comment.Via ConduitMay 6 2012, 10:45 AM

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

bzimport added a comment.Via ConduitMay 6 2012, 11:23 AM

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 http://ctan.org/tex-archive/info/lshort/english/lshort.pdf

bzimport added a comment.Via ConduitMay 9 2012, 3:40 PM

mal.malego wrote:

Now reported at https://github.com/mathjax/MathJax/issues/243 .

liangent added a comment.Via ConduitAug 7 2012, 3:42 PM

\theta = 5^\operatorname{\omicron}

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

SalixAlba added a comment.Via ConduitAug 7 2012, 4:18 PM

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.

liangent added a comment.Via ConduitAug 7 2012, 4:28 PM

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

Schnark added a comment.Via ConduitAug 20 2012, 9:06 AM

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

gerritbot added a comment.Via ConduitApr 28 2013, 12:13 PM

Related URL: https://gerrit.wikimedia.org/r/61256 (Gerrit Change If6573901bafd8599a01979bcbff89e52b51e4ffd)

gerritbot added a comment.Via ConduitApr 28 2013, 11:09 PM

Related URL: https://gerrit.wikimedia.org/r/61287 (Gerrit Change If38014bde908bb202dc63213fa21a72b52a6a42d)

TheDJ added a comment.Via ConduitApr 28 2013, 11:18 PM

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

bzimport added a comment.Via ConduitApr 30 2013, 1:08 PM

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.

bzimport added a comment.Via ConduitApr 30 2013, 1:43 PM

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.Via ConduitApr 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. 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.

bzimport added a comment.Via ConduitApr 30 2013, 4:08 PM

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.

bzimport added a comment.Via ConduitMay 2 2013, 11:36 AM

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

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?

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

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

TheDJ added a comment.Via ConduitMay 2 2013, 2:08 PM

@Nageh, sounds like a follow up of https://github.com/mathjax/MathJax/issues/226 right ? that \sf \tt fontinherit issue ?

bzimport added a comment.Via ConduitMay 2 2013, 3:21 PM

mal.malego wrote:

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

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

yes, this sounds like a bug in MathJax.

gerritbot added a comment.Via ConduitMay 19 2013, 5:15 PM

https://gerrit.wikimedia.org/r/4060 (Gerrit Change I51a72c378d3496b147eb87418c24718026306c13) | change RESTORED [by TheDJ]

gerritbot added a comment.Via ConduitMay 19 2013, 6:06 PM

Related URL: https://gerrit.wikimedia.org/r/64530 (Gerrit Change I20ac8af2253835c20431585d9caebe4066606879)

gerritbot added a comment.Via ConduitMay 19 2013, 6:13 PM

Related URL: https://gerrit.wikimedia.org/r/64531 (Gerrit Change If2fb219a1191caeecb0ed04bf0c0105621725dce)

bzimport added a comment.Via ConduitOct 22 2013, 7:17 PM

physik wrote:

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.

SalixAlba added a comment.Via ConduitMar 11 2014, 2:13 PM

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.

TheDJ added a comment.Via ConduitApr 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.

bzimport added a comment.Via ConduitApr 6 2014, 11:34 AM

mal.malego wrote:

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

gerritbot added a comment.Via ConduitOct 12 2014, 3:13 PM

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

bzimport added a comment.Via ConduitOct 19 2014, 6:18 PM

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.
See https://github.com/mathjax/MathJax/pull/882

Nemo_bis added subscribers: bzimport, Nemo_bis.Via WebApr 24 2015, 4:01 PM

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.
See https://github.com/mathjax/MathJax/pull/882

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

Physikerwelt added a subscriber: Physikerwelt.EditedVia WebApr 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 https://github.com/mathjax/MathJax/blob/master/unpacked/extensions/TeX/mediawiki-texvc.js

Nemo_bis added a comment.Via WebApr 24 2015, 4:16 PM

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

Physikerwelt added a comment.Via WebApr 24 2015, 4:25 PM

No. Not directly. But I have hope that
https://phabricator.wikimedia.org/T97124
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.

polybuildr added a subscriber: polybuildr.Via WebApr 24 2015, 6:00 PM
polybuildr added a comment.Via WebApr 24 2015, 6:05 PM

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

Physikerwelt added a comment.Via WebApr 24 2015, 8:29 PM

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 https://chrome.google.com/webstore/detail/wikipedia-with-mathjax/fhomhkjcommffnlajeemenejemmegcmi

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

MathJax will be removed T99369

Add Comment