(Config) Enable local STIX fonts for MathJax
Closed, ResolvedPublic

Description

Currently, MathJax 2.3 is installed, but local STIX fonts are blocked in its configuration.

MathJax should "prefer" *local* STIX font, and fall back to using TeX webfonts. This is the default behaviour for MathJax 2.3.

Sorry, I can't submit a patch; I don't have a local repository.


Version: unspecified
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=35498

Details

Reference
bz63016
bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz63016.
Edokter created this task.Mar 24 2014, 4:54 PM

Is this about code in MathJax or is this about configuration of some Wikimedia servers?

MathJax has its own configuration file (config/default.js), which is where the change needs to be made.

Pkra added a comment.Mar 28 2014, 9:38 AM

@Andre this is about the configuration used by the MediaWiki Math Extension.

Specifically, this line https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FMath/88d3368c23efc963ceae127bea175191bc82893e/modules%2Fext.math.mathjax.enabler.js#L25

availableFonts: ["TeX"]

which restricts MathJax to only use locally installed MathJax-TeX fonts.

The MathJax default (see http://docs.mathjax.org/en/latest/options/HTML-CSS.html) is

availableFonts: ["STIX","TeX"]

and in the next MathJax release any other MathJax-compatible font a user might have installed will be recognised as well.

Peter.

MathJax config is complicated at best, but I think it needs to be:

availableFonts: ["STIX","TeX"]
preferredFont: "STIX"
webFont: "TeX"

This should cause to use STIX or TeX when locally available, or TeX webfont if no local fonts are available.

Pkra added a comment.Mar 28 2014, 8:38 PM

@Erwin do you intentionally want to force the preference for locally installed fonts to STIX?

Since the math extension currently prefers TeX webfonts (not STIX webfonts), it seems more natural to prefer TeX.

This also comes at no price for your personal preference -- if you don't install the TeX fonts on your machine, MathJax will still prefer locally installed STIX fonts over any webfonts (as long as availableFonts allows it).

The preferredFont value only decides which locally installed fonts to prefer if multiple compatible fonts are installed.

@Peter, yes. I prefer the STIX fonts, and the word is that the next major version of MathJax (3.0?) will include the STIX webfonts and use it as default.

Pkra added a comment.Mar 31 2014, 8:27 AM

(In reply to Erwin Dokter from comment #6)

@Peter, yes. I prefer the STIX fonts, and the word is that the next major
version of MathJax (3.0?) will include the STIX webfonts and use it as
default.

MathJax v2.3 already includes STIX webfonts but there are no plans to make them the MathJax default.

(In reply to Peter Krautzberger from comment #7)

MathJax v2.3 already includes STIX webfonts

I had to check that... Indeed they do (though they are not the native upcoming STIX 2.0 webfonts). Even so, all the better. So why are we not using STIX instead of that midievil TeX font?

At the very least, it should be set to its default:

availableFonts: ["STIX","TeX"],
preferredFont: "TeX",
webFont: "TeX",
Pkra added a comment.Mar 31 2014, 8:53 PM

though they are not the native upcoming STIX 2.0 webfonts

Not sure what you are referring to here. MathJax contributed the STIX webfonts to STIpub in November (when MathJax v2.3 came out). The STIX webfonts are based on the older "STIX General" fonts because the newer "STIX Word" fonts do not work fully in browsers right now.

Just forget it... a year ago they were still talking about 2.0. Apparently they made it 1.1.1 instead.

Point is, can we please restore the default config?

And I have to ask again (and please refer me to the proper developer if not here): why *are* we not using STIX as default?

TheDJ added a comment.Apr 1 2014, 12:03 PM

Everything we have is copied from Nageh's script originally, so I assume this used to be in there as well.

So.... do I need to remove this line ?
https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FMath/88d3368c23efc963ceae127bea175191bc82893e/modules%2Fext.math.mathjax.enabler.js#L25

Pkra added a comment.Apr 1 2014, 2:44 PM

@Derk-Jan yes, deleting that line should do the trick.

mal.malego wrote:

@DJ: Since I'm still getting these mails... I had changed my setup to prefer STIX fonts back on April 1, 2012. ;-) Anyway, while you're at editing that file, I suggest adding extensions: ["color.js"] to the config environment to make the \color commands compatible with texvc (and LaTeX). See http://docs.mathjax.org/en/latest/tex.html#color
-nageh

TheDJ added a comment.Apr 5 2014, 9:07 AM

ehm. color.js is no longer in the setup ? I'm sure we added that at some point..

Change 124055 had a related patch set uploaded by TheDJ:
Reset the fontstack of mathjax back to defaults

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

mal.malego wrote:

I think so, too, I guess color.js got lost at some point during the rewrite. Btw, why is the input/MathML jax part of the config? Unless I'm mistaken the mediawiki backend doesn't provide any means for generating MathML.

TheDJ added a comment.Apr 5 2014, 10:51 AM

@Nageh, that's for what physikerwelt is working on with his Math 2.0 and MathSearch

http://arxiv.org/abs/1304.5475
https://www.mediawiki.org/wiki/Extension:MathSearch

Change 124055 merged by jenkins-bot:
Reset the fontstack of mathjax back to defaults

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

TheDJ added a comment.Apr 7 2014, 1:11 PM

It seems that we are missing some STIX font information, that RL cannot load right now.

Debug mode shows we are missing the following: http://pastebin.com/4dR6Je6y

This is exactly why I posted a followup question in r124055: where is the default config stored? If there is none, then it should be added in MathJaxEnabler.js.

That is //gerrit.wikimedia.org/r/#/c/124055/

Where is a Bugzilla linking cheat cheat? Last attampt:

https://gerrit.wikimedia.org/r/#/c/124055/

TheDJ added a comment.Apr 7 2014, 2:25 PM

@Erwin in ./unpacked/jax/output/HTML-CSS/config.js

But that is not the problem. We are missing the render information for the font. STIX doesn't just work, it needs to have information about the font in order to do the proper layouting. we are currently not serving that information, because the files are not in the repo and they are not provided as a bundle using RL from Math.php

Using TeX webfonts doesn't fare much better: http://pastebin.com/JL9LJCmL

Yet both seemingly display OK.

fredw added a comment.Apr 7 2014, 7:23 PM

(In reply to Erwin Dokter from comment #24)

Using TeX webfonts doesn't fare much better: http://pastebin.com/JL9LJCmL

Yet both seemingly display OK.

I believe these fonts (Greek, WinChrome and WinIE6) are obsolete. The woff files are not in MathJax v2.3 but the js font data are still there. I think we can remove them from Math.php so that the resource loader won't load them (and we can remove the js data from the repo).

fredw added a comment.Apr 7 2014, 7:34 PM

(In reply to Frédéric Wang from comment #25)

I believe these fonts (Greek, WinChrome and WinIE6) are obsolete. The woff
files are not in MathJax v2.3 but the js font data are still there. I think
we can remove them from Math.php so that the resource loader won't load them
(and we can remove the js data from the repo).

Well, actually some fonts are still available as otf/eot/svg. I think it would be best to ask to the MathJax team which fonts are still used and in which situations. But as I recall, these fonts were only a hack for old browsers unable to display some characters.

I see no more errors and the default configuration has been restored, rendering STIX fonts when installed. I consider this resolved.

Add Comment