Community Wishlist Survey 2017/Reading/Functional and beautiful math for everyone

From Meta, a Wikimedia project coordination wiki

Functional and beautiful math for everyone

  • Problem: The current svg and png math rendering have a lot of bugs in average browsers, see mw:User_talk:Whatamidoing_(WMF)#w:de:WP:Umfragen/Konzept_für_mathematische_Formeln and some deficiencies due to the output being images rather than text-like. Only few browsers natively support MathML rendering.
    Users should not have to use custom scripts or plugins in order to get the functionality they are used to from other websites, for example math.stackexchange or mathoverflow.
  • Who would benefit:
  • Proposed solution: Resurrect the MathJax display method that was ripped out because its implementation was "unmaintainable" (phab:T99369) and make it default for everyone. An example for a website that uses Media-Wiki and MathJax is (in an old version from 2013 that is still lacking the faster rendering options).
  • More comments:


  • @Physikerwelt: Please consider adding any additional information or Phab tickets to this proposal. Whatamidoing (WMF) (talk) 18:18, 7 November 2017 (UTC)[reply]
  • Endorse. See my blog post from a couple years ago (or also this piece by someone else) for a more detailed look at how I think Wikipedia's math formatting has been going in the wrong direction and why this proposal would be an improvement. —David Eppstein (talk) 18:27, 7 November 2017 (UTC)[reply]
  • Endorse as the best compromise for vector math, as long as a PNG fallback is also supported. The last time MathJax was available on Wikipedia, it was unusably slow in rendering on some devices. Without caching, one had to pay that price every time the page was edited. I hope that Moore's law and/or improvements to the MathJax engine have improved the situation, but maintaining the PNG option would be prudent. --Mark viking (talk) 19:12, 7 November 2017 (UTC)[reply]
  • Comment. I am not sure how this relates to the proposal at issue, but I feel it's something that needs to be considered in any such discussion.
    The most egregious issue concerning current mathematics formatting is the clash of typefaces in running text, between the sans fonts used by Wikipedia and the serif fonts used by <math> rendering and some templates, especially <math>. (I re-checked, and {{math}} is not as bad as I thought it was, but see en:e (mathematical constant) for how bad <math> can be when used in running text.)
    This seems to be an issue with no very happy solution. Articles are going to be in sans; I kind of wish that weren't the case (see en:talk:Iago for one reason why), but I accept that that's a hard constraint. For mathematics, the ambiguity of sans is especially problematic, so we don't want to use it for displayed formulas. Personally I think the least bad solution is for math in running text to use a different typeface from math in displayed formulas, but there is a lot of resistance to that idea.
    Anyway, as I say, I don't really know how the proposal would impact these considerations, but if we want math to be "beautiful", I think the issue must be considered. --Trovatore (talk) 20:36, 7 November 2017 (UTC)[reply]
I am not an expert and please also note, that the proposal is not about serif vs. sans-serif and not about removing any png or svg fallback. However as far as I can tell from my limited experience, MathJax has a good algorithm to handle both font support and slow browsers (you can for example go to math.stackexchange and right click on an equation to test different rendering options). From my point of view, the math-font in inline and display equations should always be the same such that people cannot confuse e.g. and , and it should always be a font with dedicated math support, such that e.g. (I) and (l) do not look the same. There are a few dedicated sans-serief math fonts in LaTeX [1] and some others that MathJax can load as webfonts. Like in LaTeX you can explicitly force the use of sans-serif with \sf{formula} e.g. on math.stackexchange (I hope people will not do this on a large scale in Wikipedia articles). I would also consider things like weight, size, baseline, median etc. more important than matching serif and sans-serif. I would only use sans-serif when wrapped in \text or when MathJax can find a perfectly matching dedicated sans-serif math font. Since MathJax aims to support also slow browsers and different fonts, I think they have good algorithms to find compromises when necessary.--Debenben (talk) 21:53, 7 November 2017 (UTC)[reply]
  • Yes, we should switch to MathJax as the default engine for logged-out readers. MathML is not a realistic solution, and seems to be a moribund standard at best. As a case study, there should be no reason our math rendering is worse than, which manages to have relatively decent rendering. Our current system is much worse than theirs. — Carl (CBM · talk) 15:07, 8 November 2017 (UTC)[reply]
  • Endorse for the reasons already given above. As I see, this seems to be a logistic problem in the sense that the developers (for the math rendering part) are volunteers and they work for the projects that interest them. I can see that MathML can be exciting for various reasons. The unfortunate consequence is that “you fix it”: someone has to maintain the MathJax implementation. One solution is an external incentive: Wikimedia ‘’hires’’ someone whose job, among the others, is to maintain the MathJax support. —- Taku (talk) 19:15, 8 November 2017 (UTC)[reply]
  • Note that we do use MathJax we just convert it to SVG. We specifically removed MathJax JS rendering because the load that the additional javascript and font delivery that it required was immense (and most websites that use MathJax don't care about this because its the ONLY thing they do) and because it will always load after the page has loaded. We currently do not use MathML (even though the option is still called that it's not preferred in any of the browsers) for displaying, it's only present in hidden form to help with search machine indexing, or for those that want to use it as an alternative to SVG, by making use of a browser extension or something. There are some significant technical problems here (it's WHY MathJax has to exist in the first place) that are hard to overcome with current levels of browser and operating system support. It's closer than it was a couple of years ago, but fundamental problems still exist. —TheDJ (talkcontribs) 08:28, 9 November 2017 (UTC)[reply]
  • Also I note that exactly none of the tickets linked has anything to do with MathJax. They all concern either limitations of LateX, the latex math package or our security parser for the both of them, making them INPUT problems not OUTPUT problems. 1 issue concerns the SVG rendering, which is serverside. —TheDJ (talkcontribs) 08:36, 9 November 2017 (UTC)[reply]
I know that the developers and people maintaining the software will not be happy with MathJax, after all it is a dirty Java-Script-Hack, but the point is: It works and the tickets are only a small subset of issues which work on almost every other math-website but not in Wikipedia. For example: phab:T50032 try rendering non-ASCII-characters, (Å), (für alle), (ഗ്ദ്ധ്രീ) on math.stackexchange or scholarpedia and compare it to the rendering on Wikipedia. For written documents all the problems are unheard of, no matter if you choose pdfLaTeX, XeLaTeX, LuaLaTeX ... it works perfectly. It might be that it does not work in a way that is easy to integrate into a website, but that is not a "limitation of LaTeX".--Debenben (talk) 14:06, 9 November 2017 (UTC)[reply]
And for those who don't care about language support, let me give some more examples: phab:T7600 referencing equations. I miss this feature a lot. phab:T159735 and phab:T166380 which break the mhchem package such that the chemistry project at the German Wikipedia advises to only use math and not chem. On chemistry.stackexchange it is working perfectly. And maybe an additional remark about "most websites that use MathJax don't care about [the additional server load etc.] because it is the ONLY thing they do" - Yes, websites like physics.stackexchange simply cannot afford to have a broken or ugly math rendering because there are plenty alternatives, even websites like do not mind the additional effort. For Wikipedia there is not much competition, but I am sure, the effect of the bad math rendering will kick in eventually and projects like Wikibooks or Wikiversity might feel it already.--Debenben (talk) 19:10, 9 November 2017 (UTC)[reply]
My point is, you are making incorrect connections between cause and effect. Just because other sites (that possibly use MathJax) don't validate arbitrary input of formulas is no reason to start doing the same on the 5th web property, where you don't even need an account to edit. That's dangerous (and simply not gonna happen). We had MathJax for a while, and those tickets were issues back then as well. I know, because I helped add MathJax and maintained it for a while. There are many problems here, and i'm telling you that MathJax is not some magic fairy dust that you can sprinkle to solve all of them. —TheDJ (talkcontribs) 21:27, 9 November 2017 (UTC)[reply]
And yet those other sites have working good math and we don't. You might consider that, if it does work for them, your reasoning for why it can't possibly work might be faulty. —David Eppstein (talk) 08:12, 10 November 2017 (UTC)[reply]
@TheDJ: I am grateful for your work and that of all the other volunteers who helped to integrate MathJax. What I am saying is: svg is a bad rendering in the first place. What you are saying is: Here at Wikipedia, we can even make it worse by adding a broken "validation" that destroys the LaTeX input before passing it to MathJax and having some server-side svg-issues.--Debenben (talk) 08:49, 10 November 2017 (UTC)[reply]
As always, there is no point in discussing this any further. It's like talking to people who diagnosed themselves by googling and now tell the doctor they can only be cured by being prescribed the one particular medicine, side effects be damned. I can't and it is not my intention to stop you from asking for your pillz, i was just trying to refine the proposal. But if no one cares, then it is clear that my assistance is not needed here. —TheDJ (talkcontribs) 11:13, 13 November 2017 (UTC)[reply]
  • Endorse. I don't know what all the technical issues are but on MathJax works well and doesn't suffer from the problems found in Wikipedia articles. Currently we have notation whose font size doesn't match that of the surrounding text and can be two or three times as big, that often doesn't have the baseline in the right place, and that results in horrible misalignments. Michael Hardy (talk) 05:28, 13 November 2017 (UTC)[reply]

@TheDJ: well, if client-side MathJax rendering can't be resurrected, what can be done here? Are some tickets mentioned here solvable? I would also like to point to phab:T172864 which also refers to the math problems. --Vachovec1 (talk) 19:13, 13 November 2017 (UTC)[reply]

side remark: phab:T172864 from 2017 is actually only a reminder about w:de:Wikipedia:Technische Wünsche/Topwünsche/Schriftgröße mathematischer Formeln vereinheitlichen ("=unify font size of mathematical formulas") - status unclear, a top 10 wish of the German community from 2015 that mysteriously got linked to phab:T132607 (=improvement for <5% (?) of readers). On my home computer with a recent version of firefox, the MathML add-on and some extra fonts installed, the rendering is good, if I use MathJax with a userscript it is also good, this also looked good with the old MathJax rendering option, but that does not help the average reader and it does not help the editors who would like to write articles that are not completely broken or ugly in the default view. Another wish from 2015 that made it into the top 30 is just below: w:de:Wikipedia:Umfragen/Technische Wünsche 2015/Artikel#Barrierefreie Darstellung von mathematischen Formeln, the description sais: "use a system like MathJax to make mathematical formulas accessible". MathJax gets shipped with the accessibility explorer by default, which can be used to navigate through the formula with arrow keys and any average screenreader can read out the generated text piece by piece, just try it out - it works. Currently you need at least some very special software installed on your computer if you want to do something like that on Wikipedia and the template workarounds often used out of desperation e.g. on the English Wikipedia in order to not render inline-formulas completely ugly are most likely not accessible at all.
@TheDJ: What is your proposal then? I would be very happy if you have a better solution. I just do not know any other because every major math site uses MathJax and MathML is not a realistic option, see e.g. [2]: "When MathJax started, it was considered a temporary solution, to bridge the time until browsers implemented MathML alongside HTML5. Today, that moment seems further away than it was 5 years ago with the two leading browsers (Internet Explorer and Chrome or 55-75% of the market) having no plans to support MathML, even actively removing support for MathML or for plugins that could compensate."--Debenben (talk) 15:15, 15 November 2017 (UTC)[reply]
Fix the bugs, invest in helping the one volunteer who actually maintains all of this, re evaluate MathJax, and accept that sometime the web just cannot guarantee perfect typesetting yet, because that's simply not what it was ever designed for. —TheDJ (talkcontribs) 22:42, 15 November 2017 (UTC)[reply]
Agreed, that is why I put it here in the first place. MathJax works, but it needs infrastructure and maintenance especially with respect to security issues and it should not rely on Physikerwelt, currently the one volunteer all maths and science on Wikipedia relies on for keeping the current rendering system working at all.--Debenben (talk) 10:34, 16 November 2017 (UTC)[reply]
@TheDJ: Unless I completely missunderstood Denebens intentions, this proposal tries to bring math rendering high enough on the priority scale to go beyond an effort of lonely volunteers. That is, have paid programmers dedicate whatever effort is needed to fix the most blatant issues. This would be donation money well spent according to the intentions of the donors. While I certainly have an opinion on the proposed techniques, I don't care how type setting is achieved as long as formulas finally stop to stand out as sore thumb even with the most common set-ups.---<(kmk)>- (talk) 23:51, 27 November 2017 (UTC)[reply]
Yes, just to clarify: At the end I do not care about the technique used to achieve this. I am just pushing for MathJax and an HTML-based solution because I know that it works well on all major math-related websites an I know that it used to work well in Wikipedia from an editor and reader point of view. And last but not least, the 2015 and 2017 wishes were formulated without suggesting a particular technical solution and it seems like people do not understand what is meant by "unifying font size" or how this could be done.--Debenben (talk) 08:33, 28 November 2017 (UTC)[reply]