Extension:Math/Roadmap

The Math extension (or, more broadly, the rendering of the $$ tag) has a long history. It has been modified by a number of different people with different goals, different ideas, and different programming styles, using different underlying technologies. As a result, this extension's design and documentation are somewhat chaotic.

The aim of this page is to develop a consistent proposal for the future development of this extension. If you are interested in helping, you may edit this page directly, leave a comment on the discussion page or join our commission at T195861.

Quick and dirty syntax update strategy
The aim of this update strategy is to get rid of the texvcjs modifications as soon as possible, accepting some temporary errors. Other changes will be deferred to a later date, so they can be discussed and prepared in detail without risking that, if we encounter problems during this discussion and preparation phase, syntax workarounds for mhchem continue to grow and become unmanageable.

Theoretically, the texvcjs modifications also enable the use of non-standard notation for conventional equations, exaggerated example: a=\sqrt[\begin{align}[did you know that \exp=\frac{1}{2}? & be careful adding other stuff, it might break the layout]\\b^2\\&\\\end{align}+c^2] using a code that looks like: however this is not needed and usually not done, because the conventional notation works.

Step 1 Part A: Remove problematic texvc redefinitions
Remove only non-standard texvc redefinitions that cannot be easily absorbed by including the texvc package, which is roughly equivalent to a LaTeX-header like Extension:Math/TeX-header. Those problematic redefinitions are Since we do not have a live database of all mathematical equations and their origin we rely on the xml dumps.

Step 1 Part B: Investigate and remove strange errors
Investigate and remove strange errors like resulting in Failed to parse (Conversion error. Server ("https://wikimedia.org/api/rest_") reported: "Cannot get mml. TeX parse error: Extra close brace or missing open brace"): {\displaystyle {\ce {^3 [X]}}}  which are not triggered by texvcjs(?), but some other modification / interaction with MediaWiki??? Needs help

Step 1 Part C: Manual fixing of mhchem syntax

 * ❌ Compare the rendering of all equations in the xml dumps using texvc+legacy mhchem to up-to-date mhchem, for those using \ce seems hopeless, just changing legacy=true to legacy=false e.g. :
 * Otherwise: Go through all mhchem equations in the xml dumps manually and remove known problems. Full list of mhchem: w:de:Benutzer:Debenben/mhchem
 * If the correct syntax causes an error, just use some other workaround e.g. using math tags which doesn't cause errors during the update and put them in a list to be revisited after the update

Step 1 Part D: Wikidata replacements
Search the math and chem at Wikidata which doesn't have a recombined xml dump file and doesn't use the same tags(?)

Step 1 Part E: Remove problematic texvc macros from visual formula editor
see T197842
 * Remove \and and \or from visual formula editor help dialogue and autocompletion for the other problematic commands.✅
 * Add warining categories for mhchem.✅

Step 2
Wait for a new xml dump and check that most of the problematic syntax is gone.

Step 3

 * Remove the texvcjs modifications in production and just pass the original code to MathJax, leave the rejection mechanism in place until we have investigated the impact on security and sorted through additional commands that would become available.
 * Make unescaped $ % and \or macros an error

Step 4

 * Go through the error categories of all MediaWiki projects to find equations that have slipped through the regression test and cause errors.
 * Revisit the list of mhchem-workarounds where the correct syntax wasn't possible before.

Step 5

 * Change legacy=true to legacy=false in the config for mhchem.
 * Allow $ with correct behavior for mhchem syntax

Further long term strategic goals
Discuss and implement other changes like
 * depricate and remove further non-standard texvc syntax
 * clean up problems with tags (ineffective inline styles, self-closing math tags, ce tags)
 * support unicode based input
 * add (more) semantic macros
 * support referencing (\label, \tag, \eqref...)
 * support wikilinks (\href)
 * create a viable distinction of inline and block formulae
 * rethink $$ and redundancy
 * rethink and update the documentation pages

Syntax changes and tag problems that should be addressed after texvcjs modifications are gone: