It seems that there is a consensus that it is a good idea to create a bot that replaces

:<math

with

<math display=block

Create a bot that replaces :<math with <math display=block

Description

It seems that there is a consensus that it is a good idea to create a bot that replaces

:<math

with

<math display=block

Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|

Open | None | T122103 Option to set indentation of displayed formulæ | |||

Open | None | T111712 Provide an "indented display" styling for formulæ in lieu of the ":<math>" hack | |||

Open | None | T268922 make <math> tags without argument to be inline math | |||

Open | None | T268935 Create a bot that replaces :<math with <math display=block |

Comment Actions

I think this is a good idea. See also recent changes to the en.wikipedia manual of style for mathematics formatting, https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style/Mathematics#Using_LaTeX_markup, that recommended display=block over :-indentation.

Comment Actions

Note however that this should only be done when the ONLY content of the indented line is a single math block. There will be some instances where a displayed formula drops out of math to add some additional text on the same line, and those will probably need a human editor to figure out what do do with them.

Comment Actions

I was about to write that there's a case where additional text on the same line can be handled automatically, namely when it's just punctuation. Putting a comma or a period outside the </math> tag is a fairly common typographical error which feels like it should be trivially fixable. But there are cases where that's wrong, like when the <math> tag ends with \end{align}. And there are cases which require editing the contents of the <math> tag, like when someone ended the formula with explicit whitespace like \, and \! to avoid HTML output. So really I think that this bot should:

- Find lines starting with :, followed by any amount of whitespace, followed by <math>. (Yes, there are articles with whitespace there; I've never understood why.)
- If there is a single <math> ... </math> block on that line, and if the line contains only whitespace after the </math>, convert the initial :<math> to <math display="block">
- Otherwise, tag the line with a maintenance template.

Comment Actions

Sounds good to me. Will this be applied to enwiki or to all wikis, i.e., there are quite some math uses in wikiversity.

Comment Actions

I'm now running my script to look for awkward cases.

In https://en.wikipedia.org/wiki/Aristotle we have

:: <math>F=mv</math>,

with a double indent and a trailing comma.

In https://en.wikipedia.org/wiki/Arithmetic_mean

:<math>A=\frac{1}{n}\sum_{i=1}^n a_i=\frac{a_1+a_2+\cdots+a_n}{n}</math><ref>{{Cite web|last=Weisstein|first=Eric W.|title=Arithmetic Mean|url=https://mathworld.wolfram.com/ArithmeticMean.html|access-date=2020-08-21|website=mathworld.wolfram.com|language=en}}</ref>

we have complex ref on the same line after the formula.

https://en.wikipedia.org/wiki/Talk:M%C3%B6bius_function has various levels of indentation for the math formula with some quite deeply nested

:::<math>\sum_{k=1}^n \mu(k)=M(n).</math>

This is not just talk pages. https://en.wikipedia.org/wiki/Haar_measure has

* Left translate: ::<math> g S = \{g\cdot s\,:\,s \in S\}.</math> * Right translate: ::<math> S g = \{s\cdot g\,:\,s \in S\}.</math>