Page MenuHomePhabricator

\dots should be content sensitive
Closed, ResolvedPublicBUG REPORT

Assigned To
Authored By
SalixAlba
Sep 17 2026, 5:34 PM
Project Tags
Referenced Files
F104168983: Screenshot 2026-09-21 at 20.20.17.png
Sep 21 2026, 7:25 PM
F104168866: Screenshot 2026-09-21 at 20.20.06.png
Sep 21 2026, 7:25 PM
F104165320: Screenshot 2026-09-21 at 20.01.50.png
Sep 21 2026, 7:05 PM
F103451764: dotsfreq.txt
Sep 17 2026, 6:41 PM
F103448072: image.png
Sep 17 2026, 5:34 PM
F103448049: image.png
Sep 17 2026, 5:34 PM
F103448012: image.png
Sep 17 2026, 5:34 PM
F103447998: image.png
Sep 17 2026, 5:34 PM

Description

Steps to replicate the issue (include links if applicable):

Enter the formula's with Client-side SVG (mathjax) or MathML (native):

<math forcemode=mathjax>a, \dots , b</math>
<math forcemode=mathjax>a + \dots + b</math>

What happens?:

Both inputs are rendered with lower dots.

Screenshot 2026-09-21 at 20.01.50.png (622×952 px, 82 KB)

What should have happened instead?:

The second case (+) should have dots in the center of the line height instead of the bottom.

Other information (browser name/version, screenshots, etc.):

The AMS docs page says:

For most situations, the undifferentiated \dots can be used, and amsmath will
output the most suitable form based on the immediate context; if an inappropriate form results, it can be corrected after examining the output.

Event Timeline

I've a feeling this could be hard to implement, requiring some content sensitive information from the surrounding expression.

We don't explicitly list the \dots operator on https://en.wikipedia.org/wiki/Help:Displaying_a_formula so it could be argued that is syntax we do not support, there is always an explicit alternative, either \ldots or \cdots. However, there are a lot of use of this syntax on Wikipedia. By my count in is used 20,000 times on en.Wikipedia. Many of these uses are with a comma separated list, so the current default is OK.

But there are 650 cases of + \dots + which should probably be rendered with center dots.

The use with \subset and \superset are both mentioned at https://en.wikipedia.org/wiki/Wikipedia:WikiProject_Mathematics/MathFormattingBugs
there are 49 uses of \subset \dots and 11 uses of \supset \dots.

Some of the other common expressions are

401 + \dots +
296 & \dots &
 52 \wedge \dots \wedge
 52 & \dots  &
 45 + \dots </math>
 44 \times \dots \times
 36 < \dots <
 33 2, \dots </math>
 32 , \dots ,
 24 \oplus \dots \oplus
 24 = \dots =
 24 & \dots \\
 23 \otimes \dots \otimes
 21 - \dots -
 18 \cap \dots \cap

If it proves hard to solve, we could potentially get Texvc2LaTeXBot up and running again to fix the easy cases like + \dots + -> + \cdots +, and then mark \dots as deprecated syntax.

Krinkle renamed this task from \dots should be content sensative to \dots should be content sensitive.Sep 17 2026, 6:26 PM

could be argued that is syntax we do not support

It is used all over the place in English Wikipedia, and is common practice for users of AMS-LaTeX, which includes most mathematical authors. We should continue to support it.

Your search here is also missing the plenty of examples where \dots is just between letters, fractions, parentheses, ...

I've made a list of the frequency of different contexts using the regular expression r"(\S+\s*\\dots\s+\S+)"
run on all English Wikipedia pages

Demanding that editors use a lobotomized TeX without \dots (or forcing them to do so by bot conversion) is a non-solution.

If we were just sending TeX from server to client MathJax, this would never have broken. It is the intermediate step of converting to MathML and back and that is the bigger problem, of which this bug is only a symptom.

If we can fix it with a bot, we can also fix it directly in the Math extension. We will not be encouraging workarounds or changes to commonly used syntax.

If we were just sending TeX from server to client MathJax, this would never have broken. It is the intermediate step of converting to MathML and back and that is the bigger problem, of which this bug is only a symptom.

It sounds like you think MathJax has a direct TeX to SVG converter. It keep hearing this, but while this may have been the case in the past, MathJax today converts TeX to MML and MML to SVG. If you were to run MathJax on input text like $a + \dots + b$ (e.g. on https://www.mathjax.org/#demo), MathJax parses the TeX into MML, and then renders MML to SVG.

I'm not sure the limitations you attribute to MathML are justified. There may be gaps between MathML 3 and MathML Core, and some non-standard MathML attributes that MathJax depends on, but, for every MathJax SVG output there is a MathML input that produced that SVG.

Would you agree these SVG previews from https://www.mathjax.org/#demo are identical?

Screenshot 2026-09-21 at 20.20.06.png (1,820×888 px, 140 KB)

Screenshot 2026-09-21 at 20.20.17.png (1,224×884 px, 92 KB)

Here's what their website says:

MathJax’s internal format is essentially MathML (with a few additions), implemented as javascript objects rather than DOM elements, and MathJax’s various input processors all convert their original format into this internal MathML format; its output processors take this MathML and produce the proper output from it. Because the internal format is MathML-based, MathJax provides the ability to convert to and from MathML notation.

Although modern browsers have native support for rendering MathML, most implement the MathML-Core standard, which is a limited subset of MathML. Unfortunately, it does not include everything that MathJax needs in order to produce the required output for its various input formats. For example, MathML-Core does not include the <mlabeledtr> element needed to produce equation numbers near the margins, or the table attributes that full-fledged MathML uses for making aligned equations. Furthermore, the quality of the output varies from browser to browser, and some systems require you to download and install extra fonts to support the mathematical notation.

The usual way to use MathJax to process LaTeX is to use their "input/tex" component(s). I am not an expert on their internal MathML representation, but it seems unlikely that the current Mediawiki LaTeX -> MathML project is exactly reproducing it when given the same LaTeX input. But even if we could, why would we want to?

A lot of human effort (automated tests, user testing, rewriting, bugfixes, ...) has gone into making sure that MathJax's LaTeX parsing and processing code is reliable, does what people expect, etc. This widely adopted library has presumably better compatibility, a range of possible extensions and configuration options, more people who understand how the code works, much better documentation, free bugfixes in the future, ...

Instead, we're replacing that with a brand new bespoke PHP program written primarily by a few volunteers which has no users and has never been substantially tested, intended only for use in Mediawiki. This is not a standard use of MathJax, and frankly doesn't make any sense as an implementation strategy for Wikipedia. In the best imaginable case, we might be able to produce the same intermediate representation that MathJax's code will already produce off the shelf. But if that were to happen (and it currently doesn't seem to be), what advantage do we get from that? Satisfying some kind of misguided Not-Invented-Here impulse? Just the choice of programming language?

No reasonable software organization, especially not one without actual resources to spend on the project, is going to decide that "We can do everything in PHP instead of needing to also run a JavaScript program on our server" is sufficient justification for this kind of decision.

From this description, it's not even clear to me that "essentially MathML (with a few additions)" is something that we can convert to and transmit from server to client reliably and robustly. If they are adding to MathML, are those additions at the level of syntax that we can transmit, or are they internal annotations at the javascript level that are inaccessible at the mathl-syntax level? And if those additions are not documented and standardized, any attempt to reproduce them is likely to lead to significant compatibility issues if we ever want to upgrade to a later version of MathJax.

From this description, it's not even clear to me that "essentially MathML (with a few additions)" is something that we can convert to and transmit from server to client reliably and robustly.

The MathML state used by MathJax is just a tree of XML elements and attributes. There is nothing mysterious about it. This has been reliably transmittable from a server to a client since the 1990s. If you're unsure about this, use the https://www.mathjax.org/#demo to input whatever LaTeX you have, then copy the MathML representation and paste that in a new window and see how MathJax renders the MML input vs the original LaTeX. If you find a case where they differ, let me know.

I've had a go at looking at the corpus of all uses of dots on the English Wikipedia. About 10,000 equations and most fall into a number of classes, with a strong power law distribution.

Those that probably want center dots:

  • + \dots + (798 occurrences),
  • \wedge \dots \wedge (56),
  • \times \dots \times (44),
  • < \dots < (36)
  • \oplus \dots \oplus (24)
  • = \dots = (24)
  • \otimes \dots \otimes (23)
  • - \dots - (21) - personally I think lower dots look better here
  • \cap \dots \cap (18)
  • \mid \dots \mid (17)

Cases that want lower dots

  • , \dots , 4000+ cases, some with spaces, some without
  • , \dots ~400 cases, either at the end of an expression or followed by a closing bracket
  • A \dots B, where the preceding and following terms are letters, numbers, etc.
  • & \dots &, when within a matrix like environment.

I've added a set of test cases for these at https://www.mediawiki.org/wiki/Extension:Math/T438388

Full corpus of every equation with \dots in them at https://en.wikipedia.org/wiki/User:Texvc2LaTeXBot/Corpus_dots_1

There are enough extant examples of \dots – and enough people are going to keep making more, even if the existing ones were somehow all changed – that I don't think it's reasonable to break this command, which authors expect to work.

So it is going to take testing the context wherever \dots appears and making sure that the result is the same as (AMS)LaTeX in every possible circumstance, including between commas, between common binary operations, between arbitrary expressions with juxtaposition taken to imply multiplication, between relations, between integrals, etc.

I think rather than guessing, the easiest approach is to do what TeX does:

https://archive.softwareheritage.org/browse/content/sha1_git:e05c33e5d589cd1cb1ab6d74840bb02ea6f08273/?origin_url=https://github.com/latex3/latex2e&path=required/amsmath/amsmath.dtx&revision=37156372ade4d0aee1bf66f6fb1300dbae2f3aa7&snapshot=0d7220eaad70408fcc65d952ca5b0490c0198a81#L1080-L1164

It's a huge switch statement based on the character that follows the dots. We have a similar mechanism for ' and '' and ''' which we could reuse. For testing a compressed version of https://en.wikipedia.org/wiki/User:Texvc2LaTeXBot/Corpus_dots_1 that is grouped by the character following the dots would be optimal. It will take a while to implement, as we have to find the equivalent char class for every line of the tex code.

I had a feeling it would be awkward. Looking at the corpus it seems easier to test character before the dots, as we have a good number of examples that end with \dots, like 196 in the corpus

<math> (\ell_0,[\nu_0])\xrightarrow{\sigma_1}(\ell_1,[\nu_1])\dots </math>

or 1448

<math> E_\text{rot} = \frac{\ell (\ell + 1) \hbar^2}{2 \mu r_0^2}, \quad \ell = 0, 1, 2, \dots </math>

but if thats the way TeX does is then best to stick with that.

Change #1344591 had a related patch set uploaded (by Physikerwelt; author: Physikerwelt):

[mediawiki/extensions/MathSearch@master] Add DotsCorpusPage maintenance script

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

Change #1344709 had a related patch set uploaded (by Physikerwelt; author: Physikerwelt):

[mediawiki/extensions/Math@master] Make \dots depend on the following token

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

Physikerwelt moved this task from Inbox to Code Review on the Math board.

Change #1344709 merged by jenkins-bot:

[mediawiki/extensions/Math@master] Make \dots depend on the following token

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

Change #1344591 merged by jenkins-bot:

[mediawiki/extensions/MathSearch@master] Add DotsCorpusPage maintenance script

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