Page MenuHomePhabricator

Missing LaTeX AMSMath capabilities for math rendering
Open, Needs TriagePublicFeature

Description

Feature requested:

We want MediaWiki to support more LaTeX commands in its <math> environment.

This was a wish in the 2022 wishlist: https://meta.wikimedia.org/wiki/Community_Wishlist_Survey_2022/Editing/Missing_LaTeX_capabilities_for_math_rendering

Functionality/software changes

These commands should already be supported by MathJax. So, all we have to do is change texvcjs to allow these commands to be passed to MathJax in the backend.

  • Extra commands are supported by texvcjs

Commands which we probably could support. I only looked at commands in the AMSMath package/extension.

Individual commands which will be implemented in this ticket (with the exceptions noted in T318524#8263301):

  • \notag
  • \nobreakspace
  • \dddot
  • \ddddot
  • \substack
  • \ref
  • \idotsint
  • \negmedspace
  • \negthickspace
  • \negthinspace
  • \rvert
  • \lvert
  • \shoveright (implemented in T318782)
  • \shoveleft (implemented in T318782)
  • \label
  • \eqref
  • \mathring
  • \boxed
  • \genfrac
  • \tag
  • \smash

Environments (these will be implemented in T318701):

  • gather
  • gathered
  • smallmatrix (already implemented)
  • multline
  • CD
  • split
  • subarray

Other TODO items prior to deployment

Notes for testing

There are at least three aspects of testing this:

  1. Aesthetic
    1. Do newly implemented commands display on a MediaWiki article the same as when rendered locally with LaTeX?
      1. Examples: P34940
      2. Other examples can be found on the internet, including https://en.wikibooks.org/wiki/LaTeX and https://www.onemathematicalcat.org/MathJaxDocumentation/TeXSyntax.htm
  2. Parsing
    1. The changes are mostly to how LaTeX gets parsed. We want to make sure that the parser is reasonably robust against a range of possible syntax for expressing the commands.
      1. Perhaps searching on the internet for real-life examples of the newly implemented commands, rather than contrived examples.
  3. Regression
    1. Make sure existing LaTeX commands continue to display as they did before. You can take advantage of pages which already make heavy use of LaTeX such as https://meta.wikimedia.org/wiki/Help:Displaying_a_formula.

Event Timeline

Change 835552 had a related patch set uploaded (by Dom Walden; author: Dom Walden):

[mediawiki/services/texvcjs@master] Support extra LaTeX commands for the <math> environment.

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

So, the above patch only implements some of the commands listed in the description.

Not included in the patch. I will probably raise separate tasks for each of these:

  • genfrac: I am not sure how to implement this yet. This command takes 6 arguments, so we may need to write a new function type for texvcjs.
  • substack: I am not sure how to implement this yet.
  • label, tag, ref and eqref: I am not sure how to implement and I don't know if they will be useful at all. Can we just rely on wikitext features for labelling and referencing?
  • shoveright and shoveleft - we need to implement the multline environment first.
  • The environments I will probably make a separate task as they are a bit more complicated.
dom_walden renamed this task from Missing LaTeX capabilities for math rendering to Missing LaTeX AMSMath capabilities for math rendering.Sep 27 2022, 2:21 PM

Change 835552 abandoned by Dom Walden:

[mediawiki/services/texvcjs@master] Support extra LaTeX commands for the <math> environment.

Reason:

I will re-implement in PHP after T312528.

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