Page MenuHomePhabricator

Improve Math preference labels
Closed, ResolvedPublic

Description

Main problem

Status quo at https://en.wikipedia.org/wiki/Special:Preferences#mw-prefsection-rendering-math:

  • ⚪️ LaTeX source (for text browsers)
  • ⚪️ MathML (experimental; no images)
  • 🔘 Client side MathJax rendering (for browsers with limited MathML support)
  • ⚪️ SVG (MathML can be enabled via browser plugin)

It is not clear that "MathJax" and "SVG" are both powered by MathJax and both render an SVG.

This makes the upcoming change from "SVG" to "MathJax" bigger than it seems.

This makes the upcoming change from "SVG" to "MathJax" unclear. — MathJax provides multiple output formats (MathML, SVG, and TeX/CommonHTML). People may assume we plan to use its MathML or CommonHTML output format. If you happen to know our internals (MediaWiki converts LaTeX to MathML server-side), then you'll know the MathML output mode wouldn't make sense because it's already MathML before MathJax loads client-side, but this isn't obvious.

Reference to "no images" is unclear. — Historically, we had plain text LaTeX and two image formats (PNG and SVG). In that historical context, talking about images meant whether or not you got a visual or not, and implied you paid for it by downloading an image file. This has completely changed. All three options are visual now (MathML, client MathJax SVG, server MathJax SVG). And two of them use the SVG image format. The significant factor today is whether or not you download the client-side MathJax JavaScript application. The server SVG is cheap by today's standards.

Minor issues

  • The "SVG" option is SVG image, but it doesn't say that it is an image. In the browser, users mainly interact with this as an image file. The fact that it is an SVG is a detail that fewer users will appreciate.
  • The "SVG" option has outdated mentions of a "browser plugin". This is from a time where the MathML and MathJax options did not exist. Now that both exist, it no longer makes sense to refer to browser plugins as a way to show MathML or use MathJax.
  • The "MathML" option says "no images" which is meant to contrast with the "SVG" option, which has images, but the "SVG" option doesn't say that it uses an image.
  • The "MathML" option is unclear in what it does because the other two options also use MathML. I suggest emphasising that this option means "only" MathML.
  • The "MathML" option says "no images". However only 1 of the 4 options uses an image. There used to be a PNG image option as well, but this no longer exists. Plus, when the SVG image was the default, this made sense as a way to contrast with that. I suggest removing "no images". Once we rephase "SVG" as "SVG image", I think that suffices.
  • The "MathJax" option says "for browsers with limited MathML support". This is outdated, from a time when Chrome did not support MathML. Now Chrome does, but we still don't like this option by default, because the rendering isn't as good as MathJax. I suggest removing that wording and instead focus only on its use of MathJax rendering inside the browser.

Status quo

https://en.wikipedia.org/wiki/Special:Preferences#mw-prefsection-rendering-math

  • ⚪️ LaTeX source (for text browsers)
  • ⚪️ MathML (experimental; no images)
  • 🔘 Client side MathJax rendering (for browsers with limited MathML support)
  • ⚪️ SVG (MathML can be enabled via browser plugin)

Option A: Fix minor issues

  • ⚪️ LaTeX source (for text browsers)
  • ⚪️ MathML only (experimental)
  • 🔘 Client side MathJax rendering
  • ⚪️ SVG image (uses MathML)

Option B: Bigger change

  • ⚪️ LaTeX source (for text browsers)
  • ⚪️ MathML only
  • 🔘 MathML with SVG image (client side MathJax rendering)
  • ⚪️ MathML with SVG image (server side MathJax rendering)

Event Timeline

Change #1320220 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/extensions/Math@master] Improve Math preference labels for SVG/MathJax/MathML

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

Krinkle updated the task description. (Show Details)

I like B. For error reporting it would be helpful to somehow have the mode name visible.

Just one question, which one will be the default in the immediate future?

See also:

Forcemathmode has some unintuitive labels

  • forcemathmode=mathml this is server-side svg
  • forcemathmode=mathjax this is client-side svg
  • forcemathmode=native this is client-side mathml

There are also

  • forcemathmode=latexml render formula into LateXML
  • forcemathmode=source leave as latex

Which is one of the reason, why I would want to see the actual mode names in the description

The forcemathmode=mathjax mode does not seem to work, and I can't see a way to force client-side svg rendering other than setting the preference.

Ideally the preference labels should match the end user experience, rather than internals of the system.

I'm wondering if there is a case for adding other forcemathmode options so they match user preferences, say forcemathmode=server_svg forcemathmode=client_svg forcemathmode=client_mathml, but a low priority.

Just one question, which one will be the default in the immediate future?

Today, Wikipedia defaults to "MathML with SVG image (server side MathJax rendering)", aka mathmode=mathml.

The parent task changes this to "MathML with SVG image (client side MathJax rendering)", aka mathmode=mathjax.

Forcemathmode has some unintuitive labels

  • […]
  • forcemathmode=native this is client-side mathml

There are also

  • forcemathmode=latexml render formula into LateXML
  • forcemathmode=source leave as latex

I suggest avoiding the phrase "client-side mathml". Maybe you mean that the browser (i.e. a client) is responsible for pixel rendering of HTML/CSS/JPEG/SVG/MathML response from the server, but I think it might be misunderstood. Usually when people say "client-side" they are referring to something that JavaScript does, which would suggest that the server is leaving a hole in the page for browsers without JavaScript, and that client-side MathJax JavaScript is creating the MathML. This would be incorrect.

All of the options generate MathML on the server-side. Nothing is generating MathML on the client-side.

@Krinkle wrote in T271001 task description:

Before:

  • On the server, MediaWiki calls the Mathoid service which uses MathJax (in Node.js) to parse LaTeX plain text and generate MathML output and SVG output.
  • The MathML output is hidden by default with CSS.
  • The SVG output is stored as a file and rendered via an <img>.

After:

  • On the server, MediaWiki parses LaTeX plain text and generates MathML output.
  • The MathML render is visible by default.
  • MathJax (client-side JavaScript) generates <svg> output and replaces the MathML.

Change #1320220 merged by jenkins-bot:

[mediawiki/extensions/Math@master] Improve Math preference labels for SVG/MathJax/MathML

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

Change #1324277 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/extensions/Math@wmf/1.47.0-wmf.15] Improve Math preference labels for SVG/MathJax/MathML

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

Change #1324277 merged by jenkins-bot:

[mediawiki/extensions/Math@wmf/1.47.0-wmf.15] Improve Math preference labels for SVG/MathJax/MathML

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

Mentioned in SAL (#wikimedia-operations) [2026-08-12T20:34:02Z] <krinkle@deploy1003> Started scap sync-world: Backport for [[gerrit:1324277|Improve Math preference labels for SVG/MathJax/MathML (T433891)]]

Mentioned in SAL (#wikimedia-operations) [2026-08-12T20:51:38Z] <krinkle@deploy1003> krinkle: Backport for [[gerrit:1324277|Improve Math preference labels for SVG/MathJax/MathML (T433891)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-08-12T21:05:45Z] <krinkle@deploy1003> Finished scap sync-world: Backport for [[gerrit:1324277|Improve Math preference labels for SVG/MathJax/MathML (T433891)]] (duration: 31m 42s)