User talk:Nageh/mathJax

From Wikipedia, the free encyclopedia
Jump to: navigation, search


RETIRED
This user is no longer active on Wikipedia.

Contents

More testing[edit]

I've discovered how to break it badly :)

I just re-enabled it and trued changing the rendering to MathML, changing two things in the popup you get on right-clicking on a formula. And now:

  • every TeX math formula shows [Math Processing Error] in italic red.
Screen shot 2010-12-27 at 03.06.25.png

It looks like just a missing file, though it may be something you should advise testers about if it's not supported. I can just go back to PNG rendering for now, so won't try doing anything to fix it myself.--JohnBlackburnewordsdeeds 03:15, 27 December 2010 (UTC)

I didn't bother much about MathML so far because its quality is inferior to TeX output. Anyway, I have added the missing files. Nageh (talk) 11:24, 27 December 2010 (UTC)

Mathjax font download URL[edit]

The URL you give is sourceforge, and the page states that it is no longer up-to-date. Maybe it's better to post a newer URL. Or is this Mathjax an old version that requires old fonts? --Netheril96 (talk) 03:42, 22 March 2011 (UTC)

Oops. Thanks, fixed it. Nageh (talk) 07:58, 22 March 2011 (UTC)

Promotion[edit]

Aside from Help talk:Displaying a formula#Formulas as SVG? and your own userspace, is there any place people can know of your MathJax extension? It needs and deserves to be more popular. --Netheril96 (talk) 08:20, 23 March 2011 (UTC)

Thanks for the flattery. :) Well, I'm not exactly sure on which pages I could promote this extension more widely. And I don't want to look like a spammer. I'll think about it... Nageh (talk) 09:24, 23 March 2011 (UTC)
Maybe Wikipedia:Gadgets.--Netheril96 (talk) 13:47, 23 March 2011 (UTC)
I'll start with Wikipedia:WikiProject_User_scripts/Scripts. Incremental steps. :) Nageh (talk) 15:56, 23 March 2011 (UTC)
I gave it a mention at Wikipedia talk:WikiProject Mathematics.--Salix (talk): 09:59, 5 May 2011 (UTC)
Which reminds me: I mentioned it at Talk:0.999... in replying to a query.--JohnBlackburnewordsdeeds 10:54, 5 May 2011 (UTC)

Bug[edit]

It seems whenever a formula is followed by text or citation, it will be automatically reduced to text style regardless of the colon before it (or lack thereof). For example,

Failed to parse (syntax error): \frac{\bf r}{r}


Failed to parse (syntax error): \frac{\bf r}{r}
(r is the position vector).

--Netheril96 (talk) 13:47, 23 March 2011 (UTC)

It's part of the heuristic I implemented for detecting display maths, but I probably should only consider the initial colon. Will change it. Nageh (talk) 15:54, 23 March 2011 (UTC)
I was just going to fix this but then reverted the change. Why do you think this is wanted behavior? The point of display formulas is that they are stand-alone in a line. Why don't you say:
Failed to parse (syntax error): \frac{\bf r}{r}

where r is the position vector.

It can be fixed but I need convincing reasons to format something in display maths when the formula actually is not in its own line like what TeX does for display maths. Nageh (talk) 21:00, 23 March 2011 (UTC)
Because Wikipedia is not all written by me. See magnetic field#H-field and magnetic materials, magnetic potential#Magnetic vector potential for example. And I don't think revising such formula is a good idea, because other people don't see any problems. --Netheril96 (talk) 01:02, 24 March 2011 (UTC)
Okay. Examples was all that I needed. Because you can't use display maths in LaTeX and add text in the same line. I will change it. Nageh (talk) 09:25, 24 March 2011 (UTC)
Fixed. Nageh (talk) 09:53, 24 March 2011 (UTC)

Another bug, see Rotation_representation_(mathematics)#Rotation_matrix.--Netheril96 (talk) 03:14, 24 March 2011 (UTC)

Oh my, there are some incompatibilities in MathJax with regards to parameter prioritization. I really hope that the devs will fix this. For example, this would work:
\hat{\mathbf u}
whereas this does not:
\hat \mathbf u
I guess we'll have to wait for this one to be fixed in the core. (Temporary remedy may be to rewrite the formulas in "clean" TeX but of course it's not a large-scale solution.)
Thanks for the feedback! Nageh (talk) 09:28, 24 March 2011 (UTC)
Turns out that this is not really in bug in MathJax. If you use the construction in the amsart documentclass in LaTeX you'll get an error as well. In the regular article documentclass you don't. It comes down to sloppy omission of braces, and really the formulas should be fixed.
Nageh (talk) 18:01, 24 March 2011 (UTC)
But as long as texvc tolerates it, MathJax should too. This compatibility issue may hinder others' acceptance of this script. And I really want to see this succeed because I hate the extensive use of HTML instead of beautiful LaTeX formulas inline.--Netheril96 (talk) 04:38, 26 March 2011 (UTC)
I understand your sentiment, and I agree that the extension needs to be largely compatible with texvc. A minor number of incompatibilities may be acceptable though to get fixed by hand. Currently, of course, there is much to be improved. This is in part because texvc uses a whole lot of extra packages besides AMS maths, and implements too many ugly hacks that need to be replacated. Seems like a long road ahead. Nageh (talk) 07:51, 26 March 2011 (UTC)

Chrome crashes[edit]

Every time I browse photon with Chrome, it crashes when math is processed 83%.--Netheril96 (talk) 01:59, 28 March 2011 (UTC)

Can you try to track down with section it crashes in? For example, you may edit a single section and use preview to see if it crashes. Then you may be able to track down a single expression which results in a crash. Nageh (talk) 11:16, 29 March 2011 (UTC)
I'm using Chrome and coming across similar problem, occuring on pages containing few math equations like List of common misconceptions, not sure where the problem is though.Kuphrer (talk) 07:38, 28 April 2011 (UTC)
Seems like a Webkit problem. See section Incorrect positioning with reflist. Nageh (talk) 17:02, 25 May 2011 (UTC)

Loading problem[edit]

On Curvilinear coordinates, MathJax processing stops at 31%. I refreshed several times and bypassed cache but still it wouldn't finish. Using Firefox.--Netheril96 (talk) 10:48, 29 March 2011 (UTC)

Fixed. Nageh (talk) 11:16, 29 March 2011 (UTC)

Is [MathJax]/jax/output/HTML-CSS/fonts/TeX/Main/Bold/SpacingModLetters.js missing?[edit]

Thanks for the great work of porting MathJax to Wikipedia!

When browsing certain pages I found that MathJax could get stuck at loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/Main/Bold/SpacingModLetters.js followed by a message of the file failing to load. Can you confirm whether the file is missing or not? Kxx (talk | contribs) 05:22, 3 May 2011 (UTC)

Yes, it is true that certain font files are missing. I still have to work out which ones are needed on Wikipedia resp. which font files can be merged into single files for more efficient loading. I have fixed this issue. Thanks for reporting! Nageh (talk) 09:02, 5 May 2011 (UTC)

Incorrect positioning with reflist|2[edit]

Looking at Photon I noticed a strange bit of maths formatting at the bottom of the page. Tracing down the problem I reduced it down to User:Salix alba/MathJaxBug. In my browser Safari the two equations which should display in the second column of the references actually appear below the reference block. The page crashes Chrome.--Salix (talk): 11:26, 5 May 2011 (UTC)

I think this is not due to MathJax. For me, the formatting looks exactly the same as when I use the standard PNG-based texvc rendering. The strange formatting is due to the {{quote}} template. No idea what makes Chrome crash but I will consult the MathJax devs. Nageh (talk) 12:14, 5 May 2011 (UTC)
Hum, I get very different behaviour when using texvc. Which browser are you using? I've tested things on a standalone non wiki webpage just using MathJax and the LaTex options and get the same thing. The problem seems to be due to a div <div style="column-count: 2; -moz-column-count: 2; -webkit-column-count: 2; list-style-type: decimal;">...</div> Which is used to to contain the list of references. Its looking like MathJax/Safari is not clever enough to understand these div options. MathJax/Chrome just crashes the page.

The code I'm using is

<script src="../MathJax/MathJax.js">
MathJax.Hub.Config({
  jax: ["input/TeX","output/HTML-CSS"],
  extensions: ["tex2jax.js","MathMenu.js","MathZoom.js"],
  TeX: {
    extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
  }
}); 
</script>
 
<div style="column-count: 2; -moz-column-count: 2; -webkit-column-count: 2; list-style-type: decimal;">
<ol class="references">
<li id="cite_note-0">A \(a^1\)</li>
<li id="cite_note-0">B \(b^2\)</li>
<li id="cite_note-0">C \(c^3\)</li>
<li id="cite_note-0">D \(d^4\)</li>
<li id="cite_note-0">E \(e^5\)</li>
<li id="cite_note-0">F \(f^6\)</li>
</ol>
<ul>
</div>
Anyway it looks like its not a specific problem with wikipedias MathJax implementation. I'll ask a question on the MathJax mailing list.--Salix (talk): 14:43, 5 May 2011 (UTC)
Thanks a lot for tracking this. Based on the reply on the mailing list this seems to be due to a bug in Webkit on evaluating the -webkit-column-count parameter. This would also explain the crashes under Safari and Chrome experienced by others. Nageh (talk) 17:00, 25 May 2011 (UTC)

Bolditalic font[edit]

When there is bold-italic font in math, mathJax will load Web-Font bolditalic, like this :\boldsymbol{EB\alpha\omega\theta FT}, which takes a long time to load in math intensive articles. But I have already installed all MathJax fonts, including MathJax_Math-BoldItalic. Why doesn't it use local fonts? --Netheril96 (talk) 13:30, 25 May 2011 (UTC)

My best guess is that it is a cache issue. Try reloading the page while bypassing the cache. It is supposed to work, actually. Nageh (talk) 16:58, 25 May 2011 (UTC)
I reloaded several times, and reinstalled my operating system (but not for this reason) in between, but the problem persists.--Netheril96 (talk) 02:24, 26 May 2011 (UTC)
I do not experience this problem, so I can only make guesses. Based on your vector.js file you do not have use of web-fonts configured so if it is really waiting for the font to load the only explanation I can come up with is that the font file is indeed missing (or cannot be accessed). How is the maths displayed when MathJax is done? Is it in bold-italic TeX font or some browser-default font? Do you experience the same problem under different browsers? Do you use the default TeX rendering or MathML with STIX fonts? If you configure the use of web-fonts as detailed in step 1 of the installation instructions does the problem persist? (Note that web-fonts will not be loaded unless a local font file cannot be found.) Nageh (talk) 08:58, 26 May 2011 (UTC)
①In WebKit browsers this problem doesn't show up.②Sometimes it fails to load WebFont but the rendering is still fine.③TeX rendering.④I added the line of web-fonts to my vector.js, and the problem is still there (but loading is a little faster).--Netheril96 (talk) 10:11, 26 May 2011 (UTC)
Actually, it is now much faster. Consider it solved.--Netheril96 (talk) 10:15, 26 May 2011 (UTC)
Sorry to bother again, but after I added that line a lot of normal symbols became bold too. It's still a problem.--Netheril96 (talk) 12:41, 27 May 2011 (UTC)
Can you give an example of normal symbols that appear in bold face? Nageh (talk) 14:03, 27 May 2011 (UTC)
When I add that line, every x in \sin x, \cos x, \tan x, \ln x, \arccos x and so on becomes bold.
And by the way, there is a preview release of MathJax v1.1a that purports to fix some MathML problem, which I'm eager to see. If you don't have time to update or don't think preview release should be trusted, could you briefly tell me how you uploaded such amount of files to your userspace?--Netheril96 (talk) 15:26, 27 May 2011 (UTC)
The extension grew over time, so really, I uploaded each file manually. But note that several files have been merged into single files over the regular MathJax distribution, and ones not needed are left out. Currently, there are 49 files in total. For future major updates I plan to write I script that will do the upload process for me. But don't worry, I am going to update to the 1.1a release as you request. This extension is for testing anyway. (PS: Oh, and of course you will need your custom Wikipedia to MathJax converter, which is not included in the MathJax release. Furthermore, interpreter for additional MediaWiki syntax, and workarounds for various bugs. So don't expect to get MathJax working straight away by uploading it on your own. Just telling you. ;) )
Concerning the strange formatting, if it happens with TeX formatting it is likely to be a bug in MathJax for your browser configuration. I don't experience any such issues under Firefox 4.0. Nageh (talk) 15:48, 27 May 2011 (UTC)
PS: Could it be that you mistook the older v1.0.1a release for a newer version? Nageh (talk) 16:13, 27 May 2011 (UTC)
I have updated to the latest development version 1.1.2. Nageh (talk) 21:06, 27 May 2011 (UTC)

──────────────────────────────────────────────────────────────────────────────────────────────────── Actually, it is a developer on MathJax user group who made a mistake. He at first told me that the next release were going to fix the MathML problem, that is, missing space between functions like sin, cos, ln and their arguments. Just now he says that only a fork [1] fixes that; planned release doesn't include this. --Netheril96 (talk) 02:19, 28 May 2011 (UTC)

Ok, thanks. I have reviewed the changes in dpvc's developer branch, and they all look fine so I took them all over. I checked and the missing space issue in MathML is now resolved. Best, Nageh (talk) 08:48, 28 May 2011 (UTC)
Thanks for the swift update! --Netheril96 (talk) 09:42, 28 May 2011 (UTC)
Ok, just finished integrating all the changes from the developer branch into the v1.1a version. :) Nageh (talk) 09:55, 28 May 2011 (UTC)

After days I still can't stand the long waiting period of "Loading Web-Font". Are you sure your Firefox 4.0.1 doesn't have such a problem? I even tried a clean Firefox 5 (beta 3) without any addons, but the problem is still there.--Netheril96 (talk) 03:17, 4 June 2011 (UTC)

Hm, I'm having an idea. Do you only have STIX fonts installed locally but not TeX fonts? If yes, could you try if the problem persists now that I changed the configuration? Nageh (talk) 13:05, 4 June 2011 (UTC)
I uninstalled TeX fonts as you suggest and mathJax failed to load. Are you changing the default font from TeX to STIX?
And here is some peculiar facts I found during my obsessive search for a solution:
  1. If I uninstall my graphics driver, then the problem goes away, albeit with dismal rendering effects.
  2. WebKit can process without such problem, but the font will be less "bold" than Firefox' rendering.
  3. The TeX font MathJax_Math-BoldItalic will not show up with MathJax_Math-Regular and MathJax_Math-Bold in Windows 7 font folder. They coexist, but don't show up together in the view.
  4. Through Greasemonkey I invoked MathJax directly from cdn.mathjax.org, and every symbol became bold.
  5. In some MathJax demo page (like [2]) \bodlsymbol can load without problem.
So in conclusion, this bug has something to do with my graphics driver, MathJax code, Firefox and Wikipedia. It seems specially tailored to my computer.-Netheril96 (talk) 14:20, 4 June 2011 (UTC)
No, I didn't mean that you uninstall the TeX fonts. I just told MathJax to explicitly look for either STIX or TeX local fonts when rendering. Was hoping that it wouldn't attempt to access a webfont that way.
Really sorry I cannot help you more. I guess you have already tried removing the fonts and installing them again (with a restart in between, yes, Windows really needs that), checking the font file permissions, etc. What strikes me as being really odd is that MathJax is looking for a WebFont when you do have local fonts installed. It really seems like it cannot load the bold-italic font for some weird reason, and then is trying to load it from the CDN. Have you tried opening that particular font file manually, just to see if you can read it? What does it do in "safe mode"? Can you configure the amount of hardware acceleration under your graphics driver? Just some blind shots. Nageh (talk) 15:04, 4 June 2011 (UTC)
PS: Can you post a screenshot of that bold symbols problem? Nageh (talk) 15:10, 4 June 2011 (UTC)
The font file is fine. What do you mean by "safe mode"? Windows safe mode? That won't do. Neither will disabling hardware acceleration in Firefox. (I can't find hardware acceleration options in my graphics driver configuration)
You mean this screenshot?--Netheril96 (talk) 16:29, 4 June 2011 (UTC)
MathJax bug.png
Try adding this line before the importScript command:
mathJax={};mathJax.userConfig={"HTML-CSS":{webFont:null}};
If MathJax still tries to load a web-font this should be a bug. Nageh (talk) 17:14, 4 June 2011 (UTC)
Then bug it is. It seems improbable to solve the problem, now that even forbidding WebFont has no effect. Thanks anyway.--Netheril96 (talk) 17:46, 4 June 2011 (UTC)
Maybe you can give it a try at the MathJax user forum. Nageh (talk) 17:52, 4 June 2011 (UTC)
For what it's worth I did a search on the Internet for windows 7 font bug, and you'll get quite a few hits. Maybe there is something for you. Nageh (talk) 17:55, 4 June 2011 (UTC)

──────────────────────────────────────────────────────────────────────────────────────────────────── It's good to hear that turning off Direct2D support in Firefox finally solved the problem. For any reader running into the same issue, you can do that by unchecking hardware acceleration under "Preferences" menu -> "Advanced" tab. Alternatively, there are a few switches in "about:config" dealing with "gfx" rendering issues, such as "gfx.direct2d.disabled".

For your desire of having "bolder" fonts by default, that's hardly doable because there are only two type faces, "normal" and "bold". So if you set "normal" fonts "bolder" they will become "bold" but the "bold" symbols won't become darker. The best you could do is to simulate darker characters by rendering them twice. For example, adding the following line to your vector.js will print the second run with a vertical offset of 1 pixel:

mathJax={};mathJax.userConfig={styles:{".MathJax":{"text-shadow":"0px 1px"},".MathJax_MathML":{"text-shadow":"0px 1px"}}};

Don't think you will like the result, though. Nageh (talk) 20:15, 7 June 2011 (UTC)

No, I don't. So I switch back to hardware acceleration and MathML. Your mentioning mathJax.userConfig does help, though. I defined some macros to circumvent some bugs of MathML and fine tune the look, like redefine \mathbf as the same as \boldsymbol. But I failed to redefine \tfrac; I tried this
   \tfrac: ['\\dfrac{#1}{#2}',1,2]
But it doesn't work.
And maybe you should mention that configuration option on the front page, just for people like me who are crazy about fine-tuning everything.Face-grin expert.svg--Netheril96 (talk) 05:00, 8 June 2011 (UTC)
Ok, both issues dealt with. :) See documentation. Nageh (talk) 09:30, 12 June 2011 (UTC)

Discussion on WikiProject Mathematics[edit]

A discussion on mathJax is current underway at Wikipedia_talk:WikiProject Mathematics#MathJax.--Salix (talk): 07:30, 25 June 2011 (UTC)

Subscript brackets[edit]

Hello there. Firstly, thanks a lot for all of your work involving MathJax. One problem that I have notice is with subscript square bracket: A_{[B,C]}. The final bracket is very faint and is almost invisible. Fly by Night (talk) 23:01, 25 June 2011 (UTC)

I don't think Nageh has anything to do with this problem. I can reproduce it with Firefox but not with Internet Explorer. It seems to be a font rendering problem. Clearly the MathJax programming can't micro-manage the appearance of individual characters in specific sizes. Hans Adler 21:12, 26 June 2011 (UTC)
I don't know… this is the feedback page, and I decided to leave some feedback. What's clear to you is not necessarily clear to others. Fly by Night (talk) 03:45, 27 June 2011 (UTC)

underline[edit]

Another thing that needs attention:

 {\underline \mathbb Z}_X \,

Michael Hardy (talk) 04:01, 27 June 2011 (UTC)

You can use \C, \N, \R and \Z instead of the \mathbb commands. It works (more or less) fine with those: Failed to parse (PNG conversion failed; check for correct installation of latex and dvipng (or dvips + gs + convert)): \underline \Z_X.
Fly by Night (talk) 04:21, 27 June 2011 (UTC)
MathJax is getting confused with the parameter precedence. What it is trying to do is this:
Failed to parse (syntax error): \underline{\mathbb} Z_X \,
While really it should parse it like this:
 \underline {\mathbb Z}_X \,
I will need to discuss this with the main developers. Thanks for reporting! Nageh (talk) 06:53, 27 June 2011 (UTC)

Another similar bug:

 {\hat \boldsymbol \theta} \,
 \hat {\boldsymbol \theta} \,

Michael Hardy (talk) 23:15, 28 June 2011 (UTC)

This one is difficult... There are a number of distinct problems here. The first one is that TeX is a very illogical language in some regards. It distinguishes between built-in primitives and between package/user-provided macros (e.g., LaTeX is a macro superset of TeX). The way primitives and macros get expanded when parsing them is very different. MathJax does not implement this differentiation, so you may argue that there is some incompatibility here. On the other hand, and coming to the second problem, macros usually get redefined by packages/documentclasses, and because TeX is very illogical here, that usually changes the order of precedence in macros expansion. For example, both \underline \mathbb Z_X and \hat \boldsymbol \theta fail in the "amsart" documentclass. As MathJax does not implement whole documentclasses there is no way of telling what would be the "right" interpretation of parameter precedence. The third problem is that \hat \boldsymbol \theta and \hat {\boldsymbol \theta} are typographically and semantically wrong. You do not want a bold-formatted vector that is modified with a normal-formatted hat on it, but you want a bold-formatted vector whose notation includes a (bold) hat on it. Concerning \underline \mathbb Z_X, there may be a way to special-case \mathbb... I'll have to investigate into this.
Michael, do not expect MathJax to provide a 100% compatibility replacement for the texvc implementation that we currently have. What we can hope for is a 99.99% level of compatibility, and that is what I am aiming for. Hope you agree that this is a sensible way forward. Cheers, Nageh (talk) 11:05, 3 July 2011 (UTC)

For those using MathML to render output, I have fixed a bug concerning incorrect rendering of "special" font styles such as blackboard bold. Nageh (talk) 18:46, 7 July 2011 (UTC)

One deficiency fixed; another appears[edit]

Here's the code:

\begin{align}
2 + 3 & = 5 \\[45pt]
2 \times 3 & = 6
\end{align}

and now I put it within math tags:


\begin{align}
2 + 3 & = 5 \\[45pt]
2 \times 3 & = 6
\end{align}

The way this now appears in my browser window is that I no longer see this

2 + 3 = 5
[45pt]2 × 3 = 6

but instead I see this

2 + 3 = 5
2 × 3 = 6

So the bug that was there earlier is gone, but it's still not putting the 45 points of extra vertical space between lines. There are times when that feature is needed, and it currently appears in MANY Wikipedia articles. Michael Hardy (talk) 19:24, 30 June 2011 (UTC)

I said I was going to implement a work-around, not that I was going to fix it. That I will leave to the main MathJax developers; there is no point in duplicating efforts when they are going to implement this anyway (probably for the next major release). Nageh (talk) 10:48, 3 July 2011 (UTC)

Since I started viewing things on Wikipedia via mathJax, the blackboard-bold C below appears much smaller:

Sp(2n, )

Does mathJax do that somehow? Michael Hardy (talk) 18:02, 5 July 2011 (UTC)

Nope. You can verify that by viewing the page when being logged out. Nageh (talk) 06:53, 6 July 2011 (UTC)

This one should make you happy, Michael. :) One of the MathJax developers (dpvc) has committed a patch for this issue, and I have just integrated it into my user script. Nageh (talk) 12:58, 4 August 2011 (UTC)

Frac inside small columnized references[edit]

In the references section to Erdős–Straus conjecture (this version) there is a title of a paper by Tao with \frac in some math. When I view it in Chrome (on OS X) I see only " = + + "; that is, the stuff inside the fractions is missing. Maybe this has something to do with being in a small font and two column references format? Anyway it seems to be a bug. In the previous revision the math had a \scriptstyle in it but I took it out, thinking that might help; nothing changed, though. —David Eppstein (talk) 20:30, 7 July 2011 (UTC)

It may be a cache issue. Try reloading with bypassing the cache. Nageh (talk) 21:10, 7 July 2011 (UTC)
That version of that article looks OK to me. I see a fraction, then "=", then a sum of three fractions. Michael Hardy (talk) 22:22, 7 July 2011 (UTC)
This might be the same bug as in #Incorrect positioning with reflist above. There seems to be a bug with the way Web Kit handles divs in two column mode. This affects both Safari and Chrome on OSX. There is a bug on the MathJax bug tracker for this, but is more a problem with the browser. I'm not sure if its on the web-kit bug tracker yet.--Salix (talk): 22:55, 7 July 2011 (UTC)
The equation get pushed down the page. You can see it if you add 20 extra lines at the bottom of the page (say 20 list item). Then there is enough space to see the equation.--Salix (talk): 23:02, 7 July 2011 (UTC)

mathJax developers[edit]

I notified the mathJax developers of the existence of this present page and they seem to be looking it over. Michael Hardy (talk) 22:55, 21 July 2011 (UTC)

ACK. Nageh (talk) 08:26, 22 July 2011 (UTC)
Is that a problem? The mathJax person who wrote to me said he was unaware of some of the issues raised here. Michael Hardy (talk) 18:26, 23 July 2011 (UTC)
Not at all! But I'm surprised that some problems are supposed to be new... AFAIR I have forwarded all problems that I did not see fixing on my own to the developers. Nageh (talk) 18:37, 23 July 2011 (UTC)
Well, I'd like to see mathJax become the universal way TeX is viewed on Wikipedia, since that would solve the problems people have been griping and arguing about since 2003, and that will require working out the bugs. So definitely they should see this page. Wikipedia probably needs more sophisticated and elaborate behavior from mathJax than do other sites that use it, including mathoverflow and stackexchange. Michael Hardy (talk) 02:56, 24 July 2011 (UTC)
I'm not convinced that it does require working out the bugs (or, rather, working out the bugs is a necessary thing in general, but not a necessary precondition to make using MathJax universal). Despite the bugs it's already a lot better than the alternatives. —David Eppstein (talk) 04:21, 24 July 2011 (UTC)
I'm not saying there must be no bugs; I'm saying certain particular bugs make it inadvisable to do this until they've been attended to. For example, which I write \\[10pt] within certain environments, such as "cases" or "matrix", the reader should not actually see "[10pt]" in the finished document. Instead, it should serve its intended purpose. Michael Hardy (talk) 18:52, 24 July 2011 (UTC)
Different readers have different standards. I for one don't care much about that "[10pt]".—Netheril96 (talk) 00:41, 25 July 2011 (UTC)
Netheril, are you saying you're OK with the reader seeing
2 + 3 = 5
[10pt]2 × 3 = 6
when what was intended was the following?
2 + 3 = 5

2 × 3 = 6
Michael Hardy (talk) 03:03, 25 July 2011 (UTC)

────────────────────────────────────────────────────────────────────────────────────────────────────Annoying as it is, I still like mathJax better than the default non-scalable, non-customizable image mode. Bugs certainly need fixing, but you should not wait until every aspect is impeccable to start using or promoting something.—Netheril96 (talk) 05:34, 25 July 2011 (UTC)

Additionally, the more we encourage people to use it, the more eyes we will have to find these bugs and the more pressure we will have to fix them. —David Eppstein (talk) 06:18, 25 July 2011 (UTC)

Michael, that bug where you would actually see [10pt] has long been fixed. This was truly a show stopper, but missing the intended vertical space is more a flaw than a bug. Nageh (talk) 08:18, 25 July 2011 (UTC)

You say it's been "fixed", but earlier you said what you did was a workaround or something like that, and it still needed fixing in the mathJax software itself. But even if it's been fixed, the remaining "flaw" is annoying and effects hundreds, and maybe thousands, of Wikipedia articles. I think sometimes TeX on Wikipedia puts lines closer together than it would in normal document-editing usage, and I've seen articles where that can impair legibility. (But admittedly, this is probably not the sort of "show-stopper" that you mention.) Michael Hardy (talk) 00:19, 26 July 2011 (UTC)

missing file /jax/output/HTML-CSS/fonts/STIX/fontdata.js?[edit]

Hi Nageh, thanks for your efforts on this. I hope this is the appropriate place to post a bug (?) report.

I followed the installation instructions. Now when I load a page with math on it mathjax tries to load, but stalls with this message:

 "Loading [MathJax]/jax/output/HTML-CSS/fonts/STIX/fontdata.js"

After maybe 10 seconds mathjax gives up loading the file, gives a file-not-found sort of error, and then is stuck with the message

 "Processing math: 0%"

I'm using the Vector skin, and have this in the common.js skin file:

 mathJax={}; mathJax.fontDir="http://cdn.mathjax.org/mathjax/latest/fonts";
 importScript('User:Nageh/mathJax.js');

I tried it also without the first line above (starting with "mathJax") with the same result.

If I disable the STIX fonts on my computer, I do not have the problem. (I'm using a mac with OSX 10.7 (Lion) which comes with STIX fonts installed.)

Thanks Nealeyoung (talk) 04:21, 31 July 2011 (UTC)

This is correct, STIX fonts are currently not supported for the HTML/CSS output. Note that STIX fonts are currently also not available in the MathJax CDN. I have configured MathJax to only select the TeX fonts; please check if it is working now without disabling the STIX fonts on your computer. However, STIX fonts will be used if you select MathML rendering (right-click on any formula, then select Settings -> Math Renderer -> MathML) on a MathML-compatible browser. Nageh (talk) 09:16, 31 July 2011 (UTC)

The appearance of certain fractions[edit]

I've just noticed that while using mathJax,

{A \over B}

does not look the same as

\frac{A}{B}

They both gave identical results before I started using mathJax. Michael Hardy (talk) 12:57, 6 August 2011 (UTC)

They do look the same also with mathJax (as far as I can verify). If you are referring to this article the fraction in the second formula is smaller simply because it is interpreted as inline math as opposed to display math. It is part of the heuristics that mathJax implements to distinguish both. If you want to force display math simply precede the formula with the \displaystyle command (or use one formula with \text{} in between, as you did eventually). Nageh (talk) 13:56, 6 August 2011 (UTC)

Performance in IE[edit]

IE has nasty performance issues with .offset{Width,Height,Left}, which MathJax heavily relies on. There is a ticket at Microsoft Connect that complains about this. MathJax updates the DOM immediately after each formula is typeset, typically introducing a lot of new nodes, and causes a full-page re-layout. Such quadratic behavior, exacerbated by slow accesses to .offset{Width,Height,Left}, renders MathJax painfully slow on pages like "List of trigonometric identities" which contain huge numbers of formulae.

A workaround is to prevent IE from frequent re-layouts. My approach is to let MediaWiki generate PNG as usual, do something like

$('img.tex').each(function() {
    var span = document.createElement('span');
    span.className = 'tex';
    span.textContent = this.alt;
    this.appendChild(span);
});

then register a listener for the "End Typeset" signal

MathJax.Hub.Register.StartupHook('End Typeset', function() {
    $('img.tex').each(function(){
        var parent = this.parentNode;
        parent.insertBefore(this.children[1], this);
        parent.replaceChild(this.children[1], this);
    });
});

Since children of IMG elements do not participate in layout, MathJax's DOM updates have minimal impact on performance. This enables IE to typeset noticeably faster while allowing all formulae to be visible throughout.

Perhaps similar logic can be baked into the MathJax startup script. Kxx (talk | contribs) 23:21, 9 August 2011 (UTC)

Some further benchmarking shows that IE's running time when it comes to dealing MathJax is (statistically significantly) cubic in the amount of TeX code. This is an epic fail on Microsoft's part and probably warrants inclusion of the hack. Kxx (talk | contribs) 00:39, 10 August 2011 (UTC)

I recall the MathJax main developers having discussed such issues before though I haven't checked whether any relevant code has been added to the code repository. There are related discussions at the MathJax developers mailing list, e.g., [3]. You might want to bring this up at that mailing list or at the user mailing list as it is really something that should be integrated into the MathJax core code rather than my script only. Thanks, Nageh (talk) 11:25, 10 August 2011 (UTC)

I have read the discussion and also checked out the MathJax's devwiki. Seemingly the devs are well aware of the cause of the issue and intend to (partially) fix it with using a two-pass rendering strategy. (I hope that they get this right, though. Incrementally inserting typeset formulae will not help.) But before such effort comes to fruition, it may be advisable to at least put up a note in the documentation page here that provides a workaround. One change to the startup script that allows the user to supply his own MathJax initialization code will help such customization. Kxx (talk | contribs) 16:52, 10 August 2011 (UTC)
Ok, I will see what I can do about it in the next days. Nageh (talk) 17:06, 10 August 2011 (UTC)

TeX not getting rendered[edit]

In Expectation–maximization algorithm, after the heading "Alternative description", the two lines of TeX after "expectation step" and "maximization step" are not getting rendered when I view them while logged in (and using MathJax. All I see is the TeX code. What's going on? Michael Hardy (talk) 19:51, 5 October 2011 (UTC)

I've now changed the TeX code from this:
\underset{q} \operatorname{\arg\,max}
to this:
\underset{q} {\operatorname{\arg\,max}}
and now it works. I think the failure of the first version should be considered a bug. Michael Hardy (talk) 19:59, 5 October 2011 (UTC)
This is related to previous issues with parameter precedence. The MathJax parser does not know that \operatorname is taking a parameter, assuming the arguments to apply for some other command. Not much to do about this other than changing the statements to proper TeX (I suspect the standard TeX interpreter may cry as well) or collecting some really frequent issues for special handling in the mathJax code. Nageh (talk) 20:36, 5 October 2011 (UTC)

MathJax prevents Greek letters from getting rendered[edit]

At https://bugzilla.wikimedia.org/process_bug.cgi I put in a feature request in February. This morning I looked at User:Michael Hardy/scratchwork and found that \koppa, \stigma, and \coppa within TeX are finally getting rendered! I was delighted to see this. But now it turns out that they work properly only when I not logged in! That makes me suspect the problem is with MathJax.

I need these in order to continue work on Ptolemy's table of chords. And there are probably other articles in which they should be used. Michael Hardy (talk) 20:16, 5 October 2011 (UTC)

Added. Nageh (talk) 20:33, 5 October 2011 (UTC)

appearance of tables[edit]

When I'm logged in and using MathJax, this table doesn't appear the same way it appears when I'm not logged in. I intended that between the first and second columns, and again between the fourth and fifth columns, two vertical lines would be visible. That is in fact how it appears when I'm not logged in. But when I'm logged in, and hence using MathJax, I see only a single vertical line there. The comprehensibility of the table depends on those two vertical lines being marked as different from the others.


\begin{array}{l||r|r|r||r|r|r|r}
\hline
L' & \Omicron & \lambda\alpha & \kappa\varepsilon & \Omicron & \alpha & \beta & \nu \\
\alpha & \alpha & \beta & \nu & \Omicron & \alpha & \beta & \nu \\
\alpha L' & \alpha & \lambda\delta & \iota\varepsilon & \Omicron & \alpha & \beta & \nu \\
\hline
\beta & \beta & \varepsilon & \mu & \Omicron & \alpha & \beta & \nu \\
\beta L' & \beta & \lambda\zeta & \delta & \Omicron & \alpha & \beta & \mu\eta \\
\gamma & \gamma & \eta & \kappa\eta & \Omicron & \alpha & \beta & \mu\eta \\
\end{array}

Another difference is that when I'm logged in and using MathJax, I see vertical lines at the left and right edges of the table, and those are not there at all when I'm not logged in. Michael Hardy (talk) 02:54, 14 October 2011 (UTC)

The latter clearly is a bug in MathJax. I will forward your request to implement double lines to the MathJax devs. Nageh (talk) 09:03, 14 October 2011 (UTC)
I was talking about this with Davide, one of the main MathJax developers. He explained that MathJax would internally translate everything into MathML representation, and the support for partial framing is missing in the MathML specification. While this could be implemented for the HTML/CSS output and with considerable hacks also for MathML output rendering he rather wants not to do so as the standard solution for tables in HTML pages should be making use of the HTML table feature. I agree with that sentiment. For comparison, here is the same table as above formatted using a mixture of Wiki table syntax and CSS – unfortunately, it's much less convenient:
L'  \Omicron  \lambda\alpha  \kappa\varepsilon  \Omicron  \alpha  \beta  \nu
\alpha  \alpha  \beta  \nu  \Omicron  \alpha  \beta  \nu
\alpha L'  \alpha  \lambda\delta  \iota\varepsilon  \Omicron \alpha  \beta  \nu
\beta  \beta  \varepsilon  \mu  \Omicron  \alpha  \beta  \nu
\beta L'  \beta  \lambda\zeta  \delta  \Omicron  \alpha  \beta  \mu\eta
\gamma  \gamma  \eta  \kappa\eta  \Omicron  \alpha  \beta  \mu\eta
Nageh (talk) 12:21, 20 October 2011 (UTC)
Let's try something different:

\begin{array}{l||r|r|r||r|r|r|r}
L' & \Omicron & \lambda\alpha & \kappa\varepsilon & \Omicron & \alpha & \beta & \nu \\
\alpha & \alpha & \beta & \nu & \Omicron & \alpha & \beta & \nu \\
\alpha L' & \alpha & \lambda\delta & \iota\varepsilon & \Omicron & \alpha & \beta & \nu \\
\hline
\beta & \beta & \varepsilon & \mu & \Omicron & \alpha & \beta & \nu \\
\beta L' & \beta & \lambda\zeta & \delta & \Omicron & \alpha & \beta & \mu\eta \\
\gamma & \gamma & \eta & \kappa\eta & \Omicron & \alpha & \beta & \mu\eta \\
\end{array}
Much more convenient. You can use this whenever you need only partial border framing. Nageh (talk) 12:54, 20 October 2011 (UTC)

This table works without matJax, but not with mathJax[edit]


\begin{array}{ccc} \pi\varepsilon\varrho\iota\varphi\varepsilon\varrho\varepsilon\iota\tilde\omega\nu & \varepsilon\overset'\nu\vartheta\varepsilon\iota\tilde\omega\nu & \overset{\text{`}}\varepsilon\xi\eta\kappa\omicron\sigma\tau\tilde\omega\nu \\
\begin{array}{|l|} \hline \mathsf{L}' \\ \alpha \\  \alpha\;\mathsf{L}' \\  \hline\beta \\  \beta\;\mathsf{L'} \\  \gamma \\  \hline\gamma\;\mathsf{L}' \\  \delta \\  \delta\;\mathsf{L}' \\  \hline\varepsilon \\  \varepsilon\;\mathsf{L}' \\  \stigma \\  \hline\stigma\;\mathsf{L}' \\  \zeta \\  \zeta\;\mathsf{L}' \\  \hline \end{array} & \begin{array}{|r|r|r|} \hline\circ & \lambda\alpha & \kappa\varepsilon \\  \alpha & \beta & \nu \\  \alpha & \lambda\delta & \iota\varepsilon \\  \hline \beta & \varepsilon & \mu \\  \beta & \lambda\zeta & \delta \\  \gamma & \eta & \kappa\eta \\  \hline \gamma & \lambda\vartheta & \nu\beta \\  \delta & \iota\alpha & \iota\stigma \\  \delta & \mu\beta & \mu \\  \hline \varepsilon & \iota\delta & \delta \\  \varepsilon & \mu\varepsilon & \kappa\zeta \\  \stigma & \iota\stigma & \mu\vartheta \\  \hline \stigma & \mu\eta & \iota\alpha \\  \zeta & \iota\vartheta & \lambda\gamma \\  \zeta & \nu & \nu\delta \\  \hline \end{array} & \begin{array}{|r|r|r|r|} \hline \circ & \alpha & \beta & \nu \\  \circ & \alpha & \beta & \nu \\  \circ & \alpha & \beta & \nu \\  \hline \circ & \alpha & \beta & \nu \\  \circ & \alpha & \beta & \mu\eta \\  \circ & \alpha & \beta & \mu\eta \\  \hline\circ & \alpha & \beta & \mu\eta \\  \circ & \alpha & \beta & \mu\zeta \\  \circ & \alpha & \beta & \mu\zeta \\  \hline \circ & \alpha & \beta & \mu\stigma \\  \circ & \alpha & \beta & \mu\varepsilon \\  \circ & \alpha & \beta & \mu\delta \\  \hline \circ & \alpha & \beta & \mu\gamma \\  \circ & \alpha & \beta & \mu\beta \\  \circ & \alpha & \beta & \mu\alpha \\  \hline \end{array}
\end{array}

This looks very good when I'm not logged in, but when I'm logged in (and hence using mathJax), I get neither an error message nor the intended image; rather I just get TeX code, all on one long line, so that I have to scroll a long distance to the right to see the end of it. What's going on? Michael Hardy (talk) 14:57, 15 October 2011 (UTC)

Be careful with parameters, MathJax always parses them in order. The offending code was \overset\text{`}, which MathJax interprets as \overset{\text}{`} – change it to \overset{\text{`}}, as I have done above. Nageh (talk) 15:30, 15 October 2011 (UTC)
Thank you, Nageh. Michael Hardy (talk) 23:19, 15 October 2011 (UTC)

Bug in \bigl[ \bigr][edit]

Look at this:

 \mathbb{E} \bigl[ X \bigr] \,

The code between the math tags is as follows:

\mathbb{E} \bigl[ X \bigr] \,

What appears on my browser is what I'd expect if I'd written the following:

\mathbb{E} \lfloor X \rfloor \,

Let's try the latter code:

 \mathbb{E} \lfloor X \rfloor \,

This could lead to grave misunderstandings: the reader would think that what's intended is the greatest integer less than or equal to X. Michael Hardy (talk) 14:44, 17 November 2011 (UTC)

Looks ok to me, on OS X with Chrome. —David Eppstein (talk) 22:36, 17 November 2011 (UTC)
This problem seems specific to Firefox. I recall that Firefox 4.0 was far worse in the rendering of some special characters (such as maths symbols set in HTML rather than TeX here on Wikipedia) than current versions are. Alas, it seems there is nothing I or MathJax folks can do about this. Nageh (talk) 21:36, 22 November 2011 (UTC)
Looks ok to me with Firefox 8.0. The only thing is that the spacing between X and closing bracket seems too small (ie. it is not centered between the brackets), but that happens in Chrome, too. ylloh (talk) 22:40, 22 November 2011 (UTC)

Missing functions[edit]

One the N-sphere page the function \arccot is displaying in red. I guess that this is a function defined in texvc and not in MathJax. It would be possible to replace the \arccot with \operatorname{arccot} but should we be adding workarounds when texvc is still the default renderer.--Salix (talk): 08:29, 9 January 2012 (UTC)

Not sure. It doesn't hurt adding this as a predefined macro, so I have done so, as well as for \arcsec and \arccsc. But why not simply use \arctan, e.g., \phi_1^{-1} = \arctan \frac{x_{1}}{\sqrt{{x_n}^2+{x_{n-1}}^2+\cdots+{x_2}^2}} \,? Nageh (talk) 10:03, 9 January 2012 (UTC)
Ideal, thanks.--Salix (talk): 10:57, 9 January 2012 (UTC)

Spacing different[edit]

MathJax crams some things together that currently has a space between. For instance in

f'(a) = \lim_{x\rarr a} \frac{x^n-a^n}{x-a} = \lim_{x\rarr a} x^{n-1}+ax^{n-2}+ \cdots +a^{n-2}x+a^{n-1}

MathJax puts no space between the second lim and x Dmcq (talk) 17:35, 29 February 2012 (UTC)

You are right. I will upgrade to the recently released MathJax 2.0 some time in the next days. Let's see if that fixes the issue. Nageh (talk) 18:28, 29 February 2012 (UTC)
I've just stuck it in as default to see what happens and so far I'm very pleased with what's there already. Dmcq (talk) 18:46, 29 February 2012 (UTC)
The show source option when you right click on an expression is nice if you want to copy a bit of math as a basis to edit from somewhere else in Wikipedia rather than having to edit the other page and search for the Tex. Dmcq (talk) 19:05, 29 February 2012 (UTC)

It seems like MathJax 2.0 has indeed resolved this issue. I have just upgraded to the new release. As always, report any bugs you run into on this talk page, and thanks for testing! Nageh (talk) 16:25, 1 March 2012 (UTC)

Yep that's great thanks. Dmcq (talk) 22:53, 1 March 2012 (UTC)

Position of magnified view[edit]

If an maths expression is positioned at the start of a new line because it won't fit on the last and then hover over it, e.g. try 1+2+3+4+5+6+7+8+9+10+11+12+13+14=105 the magnified image appears at the right at the end of the last line. Dmcq (talk) 22:50, 1 March 2012 (UTC)

Not evident where an error is[edit]

I the current scheme if one makes a error in the tex the whole expresssion is shown in red in the preview. However I noticed that none of the expressions was output when I had an error and was using MathJax. For instance in

<math> \pi-x</math> <math> \\pi-x</math> <math> \pi-x</math>

If you take the nowiki tags off the end none of the them show up whereas only the second one has an error with two back slashes. This can be a bit disconcerting needing a binary chop if the error isn't obvious. Dmcq (talk) 11:37, 7 March 2012 (UTC)

Something has changed either with the new MediaWiki version or MathJax 2.0 as the three maths statements now get connected to a single one. Fixed that now. Nageh (talk) 12:01, 7 March 2012 (UTC)
Not sure I understand. You still get none of them showing even if you put in a,b and c instead of x. Anyway I'd have thought they should all connect up to the same thing if they were the same, just the middle one is different as it has two backward slashes. Dmcq (talk) 14:12, 7 March 2012 (UTC)
Try to clear your cache. Alternatively, open this link, if it shows an empty page try to reload with bypassing the cache. Caching of JavaScript files really sucks on Wikipedia.
The double-backslash is not an error as far as TeX is concerned: it will be interpreted as a newline followed by the text "pi". The error was due to a misconfiguration in my script. Nageh (talk) 16:14, 7 March 2012 (UTC)
Oh yes I'd forgotten that. I was just thinking of what I had intended. Thanks very much. Dmcq (talk) 17:37, 7 March 2012 (UTC)

MathJax 2.0 no longer uses Firefox MathML support by default[edit]

Mathjax 2.0 changes behavior such that MJ 2.0 no longer makes use of firefox mathml by default. I am only mentioning this to you in case you want to update the firefox mathml discussion on the mathjax installation page.

http://www.mathjax.org/2012/03/02/news/mathjax-2-0-and-the-default-rendering-in-firefox/

http://www.maths-informatique-jeux.com/blog/frederic/?post/2012/03/01/MathJax-2.0-no-longer-uses-Firefox-MathML-support-by-default-%3A-%28

DouglasCalvert (talk) 03:38, 11 March 2012 (UTC)

That doesn't change anything in practice, you can always select your preferred rendering mode in the MathJax menu. Nageh (talk) 12:59, 11 March 2012 (UTC)

Use with wikibooks?[edit]

I would like to use mathjax on the Discrete Probability page from wikibooks. Is there an easy way to do this?

http://en.wikibooks.org/wiki/High_School_Mathematics_Extensions/Discrete_Probability

DouglasCalvert (talk) 04:14, 11 March 2012 (UTC)

Unfortunately, no. I would need to carry over every single MathJax file to my WikiBooks account, and that would be far too laborious. There is a more complicated solution by using GreaseMonkey, as explained on this page, but I'm afraid you'll get quite a few errors because standard MathJax does not support the additional commands added by MediaWiki's texvc. Probably your best bet is to wait until MathJax support is officially rolled out as an experimental feature on all the Wikis. I guess this may take between several weeks and a few months to come. Nageh (talk) 13:10, 11 March 2012 (UTC)

Any updates on when mathJax will be ready to add to wikibooks? Creating a wikibook here:

http://en.wikibooks.org/wiki/Parallel_Spectral_Numerical_Methods

which could desperately use more LaTeX math features, in particular automatic equation numbering. Any answers would be particularly welcome in the discussion here:

http://en.wikibooks.org/wiki/Wikibooks:Reading_room/Proposals

Benson Muite (talk) 12:39, 18 November 2012 (UTC)

You could use the MathJax now available as an option for all mediawiki sites. Just go the you preference page and check the box on the apperance tab.--Salix (talk): 12:45, 18 November 2012 (UTC)

MathJax's Wiki script[edit]

Hi, Nageh. Have you seen this script from MathJax which says it takes the images, back-renders them into the tex, and calls MathJax. I'm no programmer (nor do I play one on the radio), so is this helpful to you or us? Thanks, and thanks for writing your script! -- Avi (talk) 20:08, 12 March 2012 (UTC)

That script interprets the alt attribute of the HTML img tags, which contains the original TeX code, and then replaces the image by the MathJax typeset formula. That script is only useful for GreaseMonkey, and does not support the additional functionality and extended TeX commands that the MediaWiki's texvc backend provides. No back-rendering there, btw. ;) Nageh (talk) 22:49, 12 March 2012 (UTC)

SVG rendering[edit]

Mathjax 2.0 added a new rendering method: SVG. It looks clearer in my opinion. Any chance that you may make it functional on Wikipedia? — Preceding unsigned comment added by Netheril96 (talkcontribs)

I tested it locally, and the output looks definitely worse, rather blurry as there is no support for kerning and hinting. I suspect it may look better on your system because of your font rendering problems we were discussing earlier on this page. I'm not sure I am going to upload the SVG font files considering that MathJax may be integrated into the MediaWiki backend some time in the near future. I'll think about it. Nageh (talk) 15:58, 16 March 2012 (UTC)

Problem with double embroidering[edit]

The following displays with the old scheme but not with MathJax

\dot \vec u

Cheers Dmcq (talk) 14:13, 23 March 2012 (UTC)

See sections #Bug and #Underline. Unfortunately, there is not really anything that can be done about it other than use proper LaTeX (i.e., \dot{\vec u}). Nageh (talk) 15:31, 23 March 2012 (UTC)
Thanks for that, at least if I come across it I can change it to
\dot {\vec u}
I wonder how many cases of this there are? It would be nice for MathJax to do it.
In fact would there be a way for a robot to go round and check the articles to see if MathJax would render the maths or give an error?, there may be other incompatibilities that give problems. Dmcq (talk) 15:00, 25 March 2012 (UTC)
What could be done is to download a database dump from [4] and scan than. We did a similar thing when considering BlahTex User:Pfafrich/Blahtex en.wikipedia fixup. There is a bug with non working Latex at [5].--Salix (talk): 15:59, 25 March 2012 (UTC)

Use STIX fonts locally?[edit]

How can I use the locally-installed STIX font set? Edokter (talk) — 10:19, 1 April 2012 (UTC)

You can now. :) They where already chosen for the MathML output mode. For the HTML-CSS rendering, I have just uploaded all the necessary support files. STIX fonts will now be selected by default when available locally. Nageh (talk) 16:11, 1 April 2012 (UTC)
Yeay! I hope they will be uploaded as web fonts once MathJax will go live. That old TeX font looks sooo 1600's... Edokter (talk) — 13:06, 15 April 2012 (UTC)

Troubleshooting[edit]

How can I check is mathJax loaded on a given Wikipedia page? Could you implement some "debug mode" with extra information such as "some required components loaded"… "nn chunks of math found"… "nn chunks processed"… "nn chunks contain errors"? Incnis Mrsi (talk) 18:49, 2 April 2012 (UTC)

In principle, you can paste javascript:alert(typeof(mathJax)!="undefined"&&mathJax.loaded) into your address bar of the current browser window to check whether MathJax has been loaded. Once MathJax has been loaded, you can right-click on any maths formula and invoke the About MathJax entry in the menu, which will give you a list of loaded configuration items.
If your request is in response to some short outage, sorry, I messed up some copy&paste action. Script should be working fine again now. (If not, open this link, refresh that page (bypassing your cache), and then reload your article while bypassing the cache). Nageh (talk) 19:08, 2 April 2012 (UTC)
How does one perform these actions and, moreover, how might one bypass one's cache? Fly by Night (talk) 23:04, 2 April 2012 (UTC)
WP:BYC. Does that answer your question? Nageh (talk) 23:25, 2 April 2012 (UTC)
Thank you for your continued support. The whole "bypassing" one's cache seemed a little to complicated. In the end I decided to "clear" my cache using my web-browser's privacy settings/options. All seems to be working well. Thanks again. 01:33, 3 April 2012 (UTC)
Good to hear that. :) Nageh (talk) 09:22, 3 April 2012 (UTC)

Base CSS[edit]

Where is (will) the base CSS for MathJax (be) located? There are some padding issues that need to be fixed, such as the excesive vertical padding around stand-alone formulas. Edokter (talk) — 13:10, 15 April 2012 (UTC)

See the MathJax documentation. For the MathML output mode, the class name is "MathJax_MathML". You can specify the CSS either in your skin.css or use the userConfig structure documented at User:Nageh/mathJax#Customization. Let me know when you find a good solution. Nageh (talk) 14:13, 15 April 2012 (UTC)
I know I can change it personally and have done so (see User:Edokter/common.css), but I'd like to fix it site-wide, so it would probably have to be done in User:Nageh/mathJax/jax/output/HTML-CSS/config.js, which seems to be missing. Edokter (talk) — 16:40, 15 April 2012 (UTC)
No, you can do it via the MathJax.Hub.Config() call, as documented. But I disagree with your assertion that the margin is excessive. The margin is as to be expected for display formulas, regular LaTeX is no different in this. Can you point me to an example where you see the margin as being excessive? Nageh (talk) 17:40, 15 April 2012 (UTC)
Just look at any block formula in Pi, one with and one without MathJax enabled; LaTeX uses images and those have no margin at all, it is by virtue of being inside <dd> tags that they have some top and bottom margin (0.2em and 0.5em). MathJax (or rather, the .MathJax_Display class) uses top and bottom margin of 1em by default... that is very different from LaTeX.
Also, I'd like to propose a font-size of 125% for block formulas (.MathJax_Display). MathJax is desinged to blend in with the website it's embedded in. However, the default Vector and Monobook font-size is 80% of the default browser size (16px). The size is perfect for inline formulas, but block formulas with sub- and supertext are almost illegible. 125% matches the old LaTeX PNG rendering perfectly.
I'd rather have these issues fixes in the root then having to overrule them in common.css. Edokter (talk) — 20:09, 15 April 2012 (UTC)
Sorry, no, this is simply not true. Try to write a .tex file with some display maths, compile it, and check the margins. Except for the bottom margin, which was a bit too much because of the html dd formatting – which I now have reduced by that bit – the margins are quite right. Reducing them as you suggested makes all the display formulas within the article text ridiculously squeezed in.
Also, display maths already is being rendered in a larger font than surrounding text (approx. to 111%). mathJax includes a heuristic to automatically tell apart display from inline maths – this is a feature! It even detects and corrects the dirty hack of using \scriptstyle to effect a normal font size used throughout the Pi article. But being a heuristic, it may fail sometimes, such as for the boxes in the Pi article; if you want to force the maths to be rendered in display-style mode simply prepend your TeX code with \displaystyle .
But I'm afraid that what you really want is everything to be rendered exactly the same way as with the old texvc PNG rendering. Nageh (talk) 21:44, 15 April 2012 (UTC)
I don't know what browser you are using, but my findings are quite sound. I am seeing quite a big differences in spacing, with margins that easily covers twice the distance between regular paragraphs. I also cannot trace the 111% you specify; I see all math rendered at 100% and I can trace no CSS to the contrary.
And I don't want it exactly like the old tex; I already stated that the inline math looks perfect. But the display math is not bigger and simply renders some formulas illegible. That is a real concern and should not be dismissed as a personal preference. I have done much here to improve readability and accesability, so let's to get on the same wavelength. Edokter (talk) — 22:43, 15 April 2012 (UTC)
You are right that display maths is being rendered in normal font size, my bad, sorry. But this is what LaTeX does, too, and it is looking good, IMO. But I tried changing the font size for display maths, and I ran into a bug in MathJax: it increases the scale of the base fonts but leaves all super- and subscripts unscaled – not looking good.
What concerns the legibility issue in the Pi article, I now understand what was going on. I never considered the \scriptstyle hack to be used for maths that is interpreted as display maths, i.e., maths started with :<math>, that is, started with a colon. What happened was the mathJax was literally interpreting the maths as to be rendered in scriptstyle font, which resulted in this tiny, illegible font. I have resolved this issue now and will update the mathJax documentation. I hope this resolves one of your issues.
Btw, I am using Firefox 11.0/Windows Vista with the HTML-CSS output mode. Oh, and thank you for your feedback, it is appreciated even when I may disagree on some aspects. Nageh (talk) 00:07, 16 April 2012 (UTC)

oiint + oiiint – sizing of integration region[edit]

I'm just trying the "quick test" of your version of MathJax, since the standard (experimental) version is too obviously broken. I see that the \scripstyle being ignored makes the integration region expression too large in the {{oiint}} and {{oiiint}} templates. Adding braces as stated does not appear to fix this. How to get the desired subscript size? — Quondum 20:34, 13 May 2012 (UTC)

Ouch. That was a stupid bug you ran over. Fixed now. Thanks for reporting! Nageh (talk) 22:26, 13 May 2012 (UTC)
Works like a charm now. Thanks. — Quondum 06:18, 14 May 2012 (UTC)

ASCIIMathML[edit]

While it looks like the experimental extension is using the Tex-AMS-MML_HTMLorMML.js configuration file, I would like to be able to use Tex-MML-AM_HTMLorMML.js so that I can also make use of asciimath2jax to display ASCIIMathML You provide the ability to tweak the Hub settings, but I think not so I can change the config file. What are your thoughts on this? Net-buoy (talk) 23:58, 17 May 2012 (UTC)

Huh? AsciiMath is an input module, so I don't see what use it would make on Wikipedia where all <math> is in LaTeX format. Can you clarify what you want? Btw, mathJax is an extension of MathJax; it doesn't use any of the standard config files but a custom one, which includes a wiki2jax.js input module and a texvc.js parser module. Nageh (talk) 10:59, 18 May 2012 (UTC)

Wiki Preferences[edit]

Hello, Nageh.

There is now an experimental option in Wiki preferences to enable MathJax as the math viewer. Is this an implementation of your script, or something different, and do you recommend removing your script from JS now that there is this option? Thank you! -- Avi (talk) 13:52, 30 May 2012 (UTC)

The MediaWiki code is based on my script, yes. However, a bug introduced in the recent MediaWiki wmf1.20 release prevents it from rendering correctly. I have implemented a work-around for my script, which means it works fine while the option from the preferences menu is broken. Other than that, my script contains further improvements that have not been carried over to the MediaWiki code base yet. Nageh (talk) 14:11, 30 May 2012 (UTC)
Thanks. So I should disable the Wiki option and keep code or can I have that enabled and as long as your script is in the JS it will work? -- Avi (talk) 14:29, 30 May 2012 (UTC)
Keeping the math option in the Preferences enabled means that all TeX code is rendered using MediaWiki. For my script to be in effect, you must switch to text-only rendering. In any case, you can keep the import of my script in your JS file. Nageh (talk) 14:59, 30 May 2012 (UTC)
OK, so I'll go back to TeX and use your script. Once again, thank you for your great script, Nageh, and I hope that mediawiki can implement a full working version of MathJax soon enough. -- Avi (talk) 15:15, 30 May 2012 (UTC)

Math left unparsed in preview[edit]

Whenever I edit an article with math in it, the Show preview button leaves the math portions as plain TeX in black (e.g. $ \mathbf{v} = (v_x,v_y,v_z). $). The math displays fine when I save the edit, though. Is this normal? My math appearance preference is set to Leave it as TeX (for text browsers) (although MathJax has the same problem) and my User:Tschwenn/vector.js contains only one line: importScript('User:Nageh/mathJax.js'); --TSchwenn (talk) 21:59, 30 May 2012 (UTC)

That's odd. Has it been like that from when you started using the script? Did you try clear your cache? I'm a bit at loss... can you paste javascript:alert(typeof(mathJax)!="undefined"&&mathJax.loaded) into your address bar when you are editing an article and tell me whether it returns "true" or "false"? Nageh (talk) 22:23, 30 May 2012 (UTC)
It's been like this since I started using the script May 20th. Did you mean javascript:alert(typeof(mathJax)!="undefined"&&mathJax.loaded)) (close parentheses)? Putting either into the Firefox address bar and pressing enter does nothing at all, and in internet explorer it just redirects to the non-existent http://www.javascript:alert... I tried suppressing the www.%s.com auto-correct rule in my registry, but then IE just sent me to a Bing search for the command. On my other Windows 7 PC, both Chrome and Firefox do nothing with the command either. --TSchwenn (talk) 04:06, 31 May 2012 (UTC)
No, there is only one parenthesis to close. I have no idea why calling javascript from within the address bar works for me while it doesn't for you. However, this change has been discussed last year at bugzilla.mozilla.org, and apparently all other browsers are blocking manually entered javascript, too. This is a major *sigh* for developers, though you can use the error console in Firefox instead. Open Extras in your Firefox menu, go to Web Developers, and then select the Error Console. There is a text field that says "Code"; enter alert(typeof(mathJax)!="undefined"&&mathJax.loaded) and it should return either "true" or "false" (hopefully). Nageh (talk) 09:45, 31 May 2012 (UTC)
Btw, which Firefox version are you using? Nageh (talk) 10:09, 31 May 2012 (UTC)
Returns false everywhere, including after clicking Show preview. I have Firefox 12.0. --TSchwenn (talk) 12:49, 31 May 2012 (UTC)
Sigh, I just figured the error console is not running in the document context. Can you try again, this time using the Web Console instead of the Error Console? Thanks, Nageh (talk) 13:14, 31 May 2012 (UTC)
Returns "true" while viewing or editing or previewing on any page with math, and "false" elsewhere (e.g. editing this section). --TSchwenn (talk) 17:04, 31 May 2012 (UTC)
Huh! I am experiencing the same problem now. I will try to find out what's going on. Thanks for reporting this issue! Nageh (talk) 18:01, 31 May 2012 (UTC) Incidentally, there is a problem with the MathJax CDN right now. I will come back to your problem later. Nageh (talk) 18:15, 31 May 2012 (UTC)
That's odd, because it means that my script has been loaded but MathJax not. Can you tell me what alert(MathJax.Hub.config.config) gives, and whether mathJax.Config(); or MathJax.Hub.Startup.onload(); has any effect when you are previewing a page with unrendered math? Nageh (talk) 20:13, 31 May 2012 (UTC)
The box says TeX-AMS-texvc_HTML.js. The other two commands do this in the web console: [16:30:28.821] mathJax.Config(); [16:30:28.834] undefined -- [16:30:58.644] MathJax.Hub.Startup.onload(); [16:30:58.657] undefined. There are no apparent effects on the page. --TSchwenn (talk) 21:36, 31 May 2012 (UTC)
Thanks. So MathJax gets loaded and configured, but for some reason it fails to convert the raw math into displayed math. I will ask the MathJax devs for help. Nageh (talk) 22:55, 31 May 2012 (UTC)
Two more questions: Is the TeX code grayed out, or does it stay black when previewing an edit? Does any of MathJax.Hub.Update();, MathJax.Hub.Reprocess();, MathJax.Hub.Rerender(); do anything? Nageh (talk) 17:07, 1 June 2012 (UTC)
After clicking Show preview the math is formatted exactly the same as the rest of the article: it's black, and clicking it does nothing special (no mathJax popup). None of those commands have any apparent effect; the web console just returns (function anonymous() {return arguments.callee.execute.apply(arguments.callee, arguments);}) --TSchwenn (talk) 19:44, 1 June 2012 (UTC)

MathJax CDN down[edit]

Guys, the MathJax CDN serving the web fonts is currently experiencing some problem. This means that everyone who has included mathJax={}; mathJax.fontDir="http://cdn.mathjax.org/mathjax/latest/fonts"; in his/her vector.js or common.js file will currently not be able to see any rendered math but only plain TeX code. I will inquire the MathJax folks about it. Nageh (talk) 18:14, 31 May 2012 (UTC)

They did say they were moving to rackspace. See http://www.mathjax.org/news/. I have the STIX fonts installed, but I have the following line in my JS:

mathJax={}; mathJax.fontDir="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/fonts"; and it still seems to work fine. -- Avi (talk) 18:51, 31 May 2012 (UTC)

Doesn't work for me either. All directories come up empty, and the fonts file is zero bytes in size. Nageh (talk) 18:56, 31 May 2012 (UTC)
I guess then I'm saved by using MathML as the renderer and having the STIX fonts installed. -- Avi (talk) 19:30, 31 May 2012 (UTC)
Yep. :) Though the HTML/CSS renderer will also default to local STIX fonts when available. Nageh (talk) 19:32, 31 May 2012 (UTC)

Issues seems to be resolved. Nageh (talk) 20:05, 31 May 2012 (UTC)

SVG option[edit]

If I select the SVG option the browser outputs TeX, and I don't know how to get back to showing the formulae again with MathJax to change the option. Any suggestions? Thanks. I'm using Google Chrome with your javascript. I notice a box at the bottom saying 'Loading [MathJax]/jax/output/SVG/config.js' and then it puts out a long line with Failed to load and a full name with that name at the end. Dmcq (talk) 23:23, 1 June 2012 (UTC)

What I did eventually was remove the javascript in my common.js to back to the built in MathJax, it displayed some maths when I put on the MathmL preference and I set it back to HTML-CSS - then when I put the javascript bask for the later verion of MathJax it was all fine again. Dmcq (talk) 23:44, 1 June 2012 (UTC)
Well, that's because the SVG files were not available for my script but they were for the MediaWiki option, so when you switched back to my script the needed files could be found in the cache. I hadn't thought that there would be demand for the SVG output mode (because I consider its quality to be a bit poor; for example, there is no font hinting), but since you requested it I have just uploaded all the necessary files. Nageh (talk) 11:16, 2 June 2012 (UTC)
Thanks very much. It was mainly just going through the options and seeing what happened but I do also sometimes want to copy out a formula for presentations and SVG would be nice for that (in fact I've used my sandbox sometimes so I can do that as the formula editor with LibreOffice Impress isn't very wonderful.) Dmcq (talk) 15:26, 2 June 2012 (UTC)
It looks like that doesn't work very well for my purpose because there isn't an easy way to export the SVG graphics. I can actually extract it using the developer tools in Chrome and then there's just a couple of simple edits but it isn't the sort of thing I'd want to do every day. Also the symbols are downloaded as outlines rather than using the fonts I downloaded from MathJax. That's a pity. The MathML support isn't good enough in what I've got to use the MathMl output by MathJax either. And the PNG are just too low quality.
So there's an opportunity there for MathJax to support exporting of SVG I think. I might actually use the SVG if my other tools can't do the job for something but definitely a thing for the very odd occasion. Dmcq (talk) 17:34, 2 June 2012 (UTC)


Anyway I've installed the TexMath package which does what I want with LibreOffice, but you can't think I won't try out other odd key presses from time to time.  ;-) Thanks again Dmcq (talk) 00:03, 3 June 2012 (UTC)

Spurious "span" in reference[edit]

In Squared triangular number, two of the references have mathematical formulae in them (with binomial coefficients, so impossible to rewrite as html). When I view them using Nageh/mathjax, I see a spurious italicized "< spanstyle="display:none;">< /span >" at the end of the reference. For example (with some minor changes to the TeX markup that don't affect the problem):

displays as something approximately like

(where I've replaced the binomial coefficient with the letter X). Oh, and it's a math italic font, not the text italic, and the angle brackets in the span don't look quite the same. Looking at the html source code generated here, I see <span class="tex"><span style="display: none;">&#160;</span></span> which apparently is what ends up getting displayed in this way via mathjax attempting to interpret the html code as math. &#160; is a no-break space character. Any ideas why this is happening, and how to fix and/or work around this? —David Eppstein (talk) 21:51, 13 June 2012 (UTC)

It's a bug in MediaWiki, not in MathJax. As you have observed, already the original HTML source includes <span class="tex"><span style="display: none;"> </span></span>. I invite you to report this bug at bugzilla. I am not going to do this, and other than this response I decided to be no more involved in Wikipedia activities because of the demonstrative arrogance of the WMF and its developers. It's sad, but obviously editor retention is not an issue to the WMF when it comes to established editors. HTH, Nageh (talk) 13:33, 14 June 2012 (UTC)

Well, it doesn't happen when I link the title by hand: "Two quick combinatorial proofs of \sum k^3 = \binom{n+1}{2}^2". So maybe it is something in the cite template that is triggering this rather than in mediawiki? —David Eppstein (talk) 16:10, 14 June 2012 (UTC)

Let me look into this again... The problem arises in the COinS section of the {{citation/core}} template, which is transcluded by the citation template. However, I don't see why the template code should be responsible for the broken outcome. I guess your best bet is to ask at the village pump. Nageh (talk) 17:30, 14 June 2012 (UTC)
I think I'll try asking at Template talk:Citation/core. That seems more likely to get a useful response than filing a bug (I think it is a mediawiki bug: the COInS data is being completely destroyed and replaced by this bogus TeX span). —David Eppstein (talk) 18:20, 14 June 2012 (UTC)
That's quite amusing, the code <span style="<math>\frac 1 2</math>">\frac 3 4</span> produces \frac 3 4. I think this deserves a place in the Obfusticated Wikipedia Source Contest ;-) Dmcq (talk) 20:50, 14 June 2012 (UTC)
I doubt that's valid html. But (closer to what's being generated here) <span style="{{urlencode:<math>\frac 1 2</math>}}">\frac 3 4</span> also produces \frac 3 4. It seems that urlencoding is not enough to prevent MediaWiki from munging the math. It's arguably not even a bug (why should urlencoding stop it from working) but it's certainly not what is desired in this case. —David Eppstein (talk) 21:02, 14 June 2012 (UTC)

This strongly hints to a bug in MediaWiki. There aren't supposed to be any <span class="tex"></span> tags in the HTML source when the PNG rendering option is chosen, yet it appears in your example. Nageh (talk) 21:52, 14 June 2012 (UTC)

MathJax slow[edit]

I'm finding MathJax incredibily slow (on each page load the browser takes ages loading fonts and .js files) – so slow that I set my preferences to PNG display for this reason alone. Any idea what this might be about? — Quondum 18:52, 16 June 2012 (UTC)

Is it really the loading of the .js and font files that takes so long? These ought to be cached and thus should be downloaded only the first time when you access them. Or are you talking about the rendering that is slow? In that case there is not much you can do about it other than: Use a fast enough CPU rather than, say, a slow mobile device; use Chrome, Firefox, or Safari, or basically everything other than Internet Explorer; and if you're using Firefox you might also try using MathML rendering rather than the default HTML/CSS output mode. Also note that rendering naturally takes long on pages with lots of maths in it. Nageh (talk) 22:28, 16 June 2012 (UTC)
Yes, it is reloading the font and .js files: it clearly indocates this. The time where it indicates that it is typesetting is a small proportion of when it says "Loading web font" (many of them). It is as though the caching has been disabled. I am using Firefox, if that is of any significance. I'm running an Intel i5 quad-core at 2.27GHz with 3GiB RAM; this should be enough (though admittedly it does look like one core's capacity is being shared by two cores during this time). Are you referring to the My preferences>Appearance>Math options? No difference between "Leave it as TeX (for text browsers)" (your script) and "MathJax (experimental; best for most browsers)". — Quondum 06:36, 17 June 2012 (UTC)
It does look like a caching issue, though I don't see what is causing it. Assuming that you don't having caching disabled in Firefox, it should work fine. What happens when you reload a mathJax file like this one in Firefox (you can use Ctrl-R to reload)? Will the page immediately be displayed again (thus loaded from Firefox's cache) or is there some lag (because it will be downloaded from the servers anew)? Nageh (talk) 12:07, 17 June 2012 (UTC)
Clicking on your link displays the text file (pretty much immediately, no messages). The first reload takes a second or so, with a few quick messages (connecting, connected). The second reload onwards shows one message for about a second (waiting for). The page itself does not get cleared (it's continuously displayed). I see no cache settings other than for offline files; I don't see anything disabled there. The pages I find slow are formula-rich. — Quondum 15:14, 17 June 2012 (UTC)
Right, you can't really notice. What you may check for is whether Firefox says "Waiting for..." and "Transferring data..." on reloading the link, or whether it only says "Waiting for...". The latter means that the data is loaded from the cache, while an additional transfer of data means that the text gets downloaded from the servers (which should only happen the first time you access the link).
As for the cache settings, there is one you can configure in your Wikipedia Preferences, but this shouldn't have any effect. Then there is the one in Firefox, though I don't think you'll have that one disabled (do you use private browsing mode?). Did you try deactivating potentially interfering add-ons? Do you experience the same issue with other browsers, e.g., Internet Explorer? It's definitely not an issue with MathJax itself, so I can only guess what's wrong here. Nageh (talk) 20:55, 17 June 2012 (UTC)
If it is not a general problem with MathJax, my concern is substantially reduced (a formula-rich page you might check is here, nearly 20 seconds to reload in Firefox). My WP preferences are set to allow caching. I do not generally use private browsing mode, but I do use the most conservative privacy settings that don't prevent functioning. Cookies for en.wikipedia.org are allowed. Disabling all extensions and add-ons makes no obvious difference. IE9 has the same problem of slow reloading of the page, though it is slightly (about 20%) faster but less informative (it does actually say that it's loading or waiting for anything). I almost never use IE and hence its settings are largely default. I'll nevertheless assume for now that it is something specific to me or my setup. — Quondum 18:16, 18 June 2012 (UTC)
Nearly 20 seconds??? How slow is your Internet connection? No really, even a full reload plus rendering takes only 3 seconds on my rather old laptop and a less than 8 Mbps connection. The best advice I can give for now is to ask at the village pump for any insight. Sorry that I cannot be of more help. Nageh (talk) 22:50, 18 June 2012 (UTC)
2.4 Mbps incoming, probably 0.6 Mbps out. Actual data transferred is about 30kB in, 42kB out, so I doubt that my connection is the cause, though it may be an international bottleneck (SA–USA), maybe latency (ping roundtrip: 370 ms). Using PNG also takes a while: say 12 seconds (60% of that with MathJax), so MathJax is acting as a small multiplier on whatever the real problem is. Thanks for your input; I'll take it further at the village pump. — Quondum 06:33, 19 June 2012 (UTC)

Would installing the STIX fonts locally help? -- Avi (talk) 17:01, 17 June 2012 (UTC)

I guess it might (I'm a bit clueless there), but if MathJax is supposed to become the preferred rendering approach for all readers, surely this would not be a suitable approach in general? — Quondum 20:12, 17 June 2012 (UTC)

Popup magnified view pops under search[edit]

MathJax has this nice feature where clicking on a formula shows you a zoomed view of it. But when I click on the array in Wythoff array (in the Monobook format for Wikipedia as is my default preference), the zoomed view of the array is obscured by the Wikipedia search form, which comes up on top of the array. Is this normal? —David Eppstein (talk) 02:18, 7 July 2012 (UTC)

In part, it's an issue with MediaWiki. For some reason, it selects a specific z-index (value 3) for the <div id="p-search"> element, which prevents MathJax from overriding the layering order because it operates in a different stacking context. One solution to solve this is to ask the MediaWiki devs to omit the z-index from the CSS... I don't see why a manual z-index would be needed at all. Another solution... well, looking at the MathJax sources it seems that the positioning element for the popup gets created as a child to the maths's immediate parent rather than as a child to the HTML root element... I guess that changing this could resolve the issue as well, but I'd need to inquire the MathJax folks on this. HTH for now. Nageh (talk) 10:56, 7 July 2012 (UTC)

IE10 compatibility[edit]

MathJax does not load in IE10 because it attempts to access document.namespaces, which is not present in IE10. A workaround to manually create a dummy:

if (!document.namespaces)
    document.namespaces = {
        add: function() {}
    };

before MathJax is loaded. Kxx (talk | contribs) 07:00, 28 August 2012 (UTC)

Just rechecked the workaround. It could break IE9 because IE9 sometimes reports an "unspecified error" when existence of document.namespaces is tested. Code that touches document.namespaces should be removed/replaced (document.namespaces itself is a nonstandard extension). Kxx (talk | contribs) 15:46, 28 August 2012 (UTC)
I think Davide (from the MathJax crew) is already aware of this. I will need to check whether some fix has been submitted to the test code repository. Nageh (talk) 15:28, 31 August 2012 (UTC)
I added some fix from the repository. Please check if it works for you now. Nageh (talk) 12:20, 1 September 2012 (UTC)
Still not working. mathJax/config/TeX-AMS-texvc_HTML.js contains something like document.namespaces[e]. Kxx (talk | contribs) 23:00, 11 September 2012 (UTC)
Right, the fix is incomplete. I added a quick workaround but I don't know if it will work in IE10, please check. Nageh (talk) 14:01, 12 September 2012 (UTC)
Now it seems to work. Thanks for the fix. Kxx (talk | contribs) 22:20, 12 September 2012 (UTC)
Cool! Good to hear that. I will forward the fix to the MathJax devs. Nageh (talk) 10:27, 13 September 2012 (UTC)

importScript in HTTPS mode[edit]

I switched to https mode a while ago, and the mathJax script is blocked by Chrome for it is not transferred in https. How should I modify the line importScript('User:Nageh/mathJax.js') so that the script is transferred from https://en.wikipedia.org/User:Nageh/mathJax.js instead?-Netheril96 (talk) 14:36, 31 August 2012 (UTC)

See if it is working now. Nageh (talk) 15:31, 31 August 2012 (UTC)
No, it isn't. I remember vaguely there is a function similar to importScript but can load scripts from arbitrary URL. Shouldn't that be the solution?--Netheril96 (talk) 16:37, 31 August 2012 (UTC)
Try mw.loader.load. Edokter (talk) — 16:51, 31 August 2012 (UTC)
Thanks. It's pretty poor negligence that importScript hasn't been adapted appropriately in the process of implementing site-wide https support. Nageh (talk) 17:50, 31 August 2012 (UTC)
mw.loader.load does not work. But it is now working if I revert back to importScript. Don't know what happened.--Netheril96 (talk) 18:45, 31 August 2012 (UTC)
Your had your old mathJax script file cached. (I guess I should have told you to refresh your cache.) Glad it works for you now. Nageh (talk) 19:42, 31 August 2012 (UTC)
Well, the Chrome extension I installed has a gesture called "cacheless reload". I guess it malfunctioned. Anyhow, thanks for the fix.--Netheril96 (talk) 03:03, 1 September 2012 (UTC)

\bold{ab} bug?[edit]

I'm noticing a bug in MathJax, whereby the a is bolded italic, and the b is unbolded italic in <math>\bold{ab}</math>:

\bold{ab}

In PNG it is it is the same as for <math>\mathbf{ab}</math> (bolded roman), here also for MathJax:

\mathbf{ab}

Any ideas? — Quondum 06:34, 10 September 2012 (UTC)

My mistake, sorry. I thought \bold would set the font face in the current context rather than in the context of a parameter. Fixed now. Nageh (talk) 13:10, 10 September 2012 (UTC)
Thanks, the bolding extends to both a and b. But the <math>\bold{ab}</math> is bold italic in MathJax, and bold roman in PNG, which is of course still a problem. I'm not sure whether \bold is intended to be italic, but they should not be different. — Quondum 13:59, 10 September 2012 (UTC)
Right, it is defined as \mathbf, not as \boldsymbol. Fixed. Nageh (talk) 14:39, 10 September 2012 (UTC)
Cool, works perfectly now. Thanks. — Quondum 19:33, 10 September 2012 (UTC)

serious bug?[edit]

While I'm logged in, and looking at socle (mathematics), I see this line and it looks fine:

\mathrm {soc}(M) = \sum \{ N \mid N \text{ is a simple submodule of }M \}. \,

But looking at the same page when I'm not logged in, I see nothing but error messages where that line should be. What's going on? Michael Hardy (talk) 16:39, 21 November 2012 (UTC)

This looks like the same bug mention on Wikipedia:Village pump (technical)#Failed to parse (Missing texvc executable; please see math/README to configure.) and on wiki project maths. When logged out rendering is handled by texvc not MathJax.--Salix (talk): 17:52, 21 November 2012 (UTC)

not equiv not rendering[edit]

I reported this at Wikipedia_talk:WikiProject_Mathematics#Math_Jax_problem

I switched over to Math Jax. On my browser (Windows IE 9, version 9.0.8112.16412, update 9.0.13) the formula

n = 4, \;\;  z = -1, \;\; z^2 = z^4 = 1, \;\; 2 \not\equiv 4 \pmod{4}.
< math >n = 4, \;\; z = -1, \;\; z^2 = z^4 = 1, \;\; 2 \not\equiv 4 \pmod{4}.< /math >


does not render correctly (the \not\equiv should be ≡ with a line through it, but is just a space on my browser)

Thanks.

And thanks for all the work on Math Jax; it looks much better than what I was getting before!

- Virginia-American (talk) 17:04, 3 March 2013 (UTC)

As far as I can tell you are using the "official" experimental MathJax version from the Preferences menu, which is based on a much older version of my user script. You might want to give my script a try and see if you are still experiencing this issue. Instructions for installation of the script are on the User:Nageh/mathJax page. HTH for now. Nageh (talk) 12:49, 4 March 2013 (UTC)
I'm using Nageh's script (HTML-CSS rendering; STIX fonts installed locally) and the notequiv looks just fine to me. -- Avi (talk) 20:28, 5 June 2013 (UTC)
I'm using the official version on OS X / Chrome (I don't remember what fonts I may or may not have installed) and it looks ok to me too. —David Eppstein (talk) 20:35, 5 June 2013 (UTC)

Often need to purge[edit]

Is this intended behaviour? It's not uncommon to see the markup, but then it disappears, all I see is horizontal lines where the fractions should be when the MathJax status goes away. Reloading doesn't seem to fix it, but purging does - implying it's server-side. Not a big deal for someone who's heard of purging - not so good for those who haven't. ChrisHodgesUK (talk) 12:20, 24 June 2013 (UTC)

This is probably because you include mathJax in both vector.js and common.js. Remove it from one of them. Also, I see that you have removed webfont support in vector.js but not in common.js. If you do not want to use webfonts make sure you have either TeX fonts (extracted from the fonts directory of the MathJax sources) or STIX fonts installed on your computer. Nageh (talk) 22:00, 24 June 2013 (UTC)
Great, thanks - I had a little trouble getting it to work reliably across all the machines I use, so probably "fixed" it badly for a system without the fonts installed. AFAICT it's working now - thanks again. ChrisHodgesUK (talk) 08:44, 25 June 2013 (UTC)

Does not work in Hindley–Milner[edit]

The page uses the typewriter font, but apparently [MathJax]/jax/output/HTML-CSS/fonts/TeX/Typewriter/Regular/Main.js is missing. Kxx (talk | contribs) 07:47, 21 August 2013 (UTC)

Hm, right, the typewriter fonts were missing. Should be fixed now. Thanks for reporting! Nageh (talk) 08:44, 21 August 2013 (UTC)

Version numbers[edit]

User:Nageh/mathJax.js contains mathJax.version = "0.2.3";, while User:Nageh/mathJax/MathJax.js contains if(!MathJax.Hub){MathJax.version="2.2";...}. The latter is what is displayed when I right-click on some math and choose "About MathJax," so I assume it's correct. Why do these version numbers not agree, and does it matter for correct operation? --SoledadKabocha (talk) 05:22, 15 February 2014 (UTC)

The former is the version of User:Nageh/mathJax.js, and the latter is the version of the MathJax library. Klortho (talk) 02:15, 24 March 2014 (UTC)

Relationship to MediaWiki Extension:MathJax[edit]

Hi, it's not obvious to me what, if any, relationship there is between your user script and the experimental MathJax rendering option in Preferences, and the mw:Extension:MathJax. Does Wikipedia use that extension? I'm guessing no, but wanted to make sure. Also, where does discussion of math rendering on Wikipedia take place? I am wondering if MathJax will ever be turned on by default, and have no idea where to ask the question. Thanks! Klortho (talk) 02:45, 24 March 2014 (UTC)

@Klortho: The mathJax of Nageh was the basis for the mathJax in the core of MediaWiki. The extension mathJax is not used on English Wikipedia, is to a large degree similar to the core MathJax mode, but a bit outdated. Most of the discussion on a technical level that occurs is as with most technical discussion, the wikitech-l mailing list. There is next to that a project that the developer Physikerwelt is working on that is partly described here. MathJax is very 'heavy', that is also the reason why it hasn't been enabled by default. There have been some ideas floating around about how we could change that, but it is a very complicated process that requires a lot of discussion and checking with WMF staff to make sure we don't blow up servers and there are only a few volunteer developers working on this. —TheDJ (talkcontribs) 22:33, 6 April 2014 (UTC)