Repository navigation
Description
This proposal is to simplify mstyle so that it only supports the following attributes:
- displaystyle
- dir
- mathsize
- mathbackground
- mathcolor
- mathvariant
- scriptlevel
And maybe:
- scriptsizemultiplier
- scriptminsize
From the Math WG mailing list:
https://lists.w3.org/Archives/Public/www-math/2016Jul/0024.html
From the appendix of the original "MathML in HTML5" document:
"The mstyle element duplicates the CSS inheritance mechanism in a CSS-incompatible way and has many exceptions to workaround the fact that attribute names may be used for different purposes. In practice, many of its attributes are not useful and never used. It is a burden for implementers since they essentially have to reimplement a specific “attribute” inheritance mechanism to support the general case even if the most prominent attributes have obvious mapping to CSS. It is also a performance issue to perform the rendering and keep it up-to-date since the rendering on any node may depend on its mstyle ancestors. In this document, it instead suggested to keep only attributes that are compatible with CSS and five new CSS properties are introduced in section 2.3.1. These attributes actually correspond to what is used in practice. "
edit:
This is the proposal for CSS attributes that cannot be mapped to style yet: https://github.com/mathml-refresh/mathml-css-proposals#mathml-css-proposals
Activity
physikerwelt commentedon Feb 19, 2019
This might be a stupid question, but why do we need
can that not implemented using the style attribute?
fred-wang commentedon Feb 19, 2019
Yes, they can be (and are) implemented using CSS style.
Whether we want to remove/deprecate these MathML attributes (and hence the whole mstyle element) is another question, but probably they have already been used a lot in existing documents. This is not really the case of attributes not mentioned in #1 (comment) , I think in a previous discussion on Math WG only one instance of another attribute (linethickness) was used in the MathML 3 test suite.
fred-wang commentedon Feb 19, 2019
Incidentally, for attributes without CSS equivalent, there is https://github.com/mathml-refresh/mathml-css-proposals#mathml-css-proposals
@physikerwelt I think in general it would be good to gather usage metrics of elements/attributes that are proposed for deprecation/removal. Maybe you can do that for wikipedia.
davidcarlisle commentedon Feb 19, 2019
html also has a dir attribute so this isn't so strange I think?
Initially the model was to preserve as far as possible that as far as possible the notion that css should be used to encode potentially reader-customizable style, and that explicit attributes in the source should be used to encode author-specified meaning.
So a clearer example would be <mi mathvariant="sans-serif" to chose a sans math alphabet as opposed to using CSS to chose the overall font style (which may be sans serif)
Of course in the end mathvariant got defined as a shift of codepoint rather than a change of font, but it was still a motivating example here.
So at the time, almost all publications were monochrome but the thought was that you may want to use colour just as fonts have been traditionally used, to have distinguished mathematical variables x mathcolor="red" and x mathcolor="blue" that are separate from a reader choice to style the whole expression in brown to match a website style...
We can decide not to keep this (and we could potentially have different decision for the mathml-core and full mathml but if you are asking why mathml3 (and 2 and 1) are this way, that is basically why.
dani31415 commentedon Feb 25, 2019
Why not
indentalign -> text-align?physikerwelt commentedon Feb 25, 2019
discussed in the telco on 2019-02-25:
** @fred-wang "in theory one could get rid of mstyle and use style of mrow"
fred-wang commentedon Mar 14, 2019
I don't think indentalign is in MathML Core. Also we should keep in mind (2) #30 (comment) applies here.
fred-wang commentedon Mar 14, 2019
This is how I understand the current status:
(1) Do we keep the
<mstyle>element? It could just be<mrow>+ CSS styles but we need (a) to define more CSS properties / remove some attributes and (b) take into account non-browser implementation and backward compatibility with existing usage #55.(2) Do we reduce the existing set of properties (suggestion: #1 (comment)).
(3) Do we just map properties to CSS instead of defining our own inheritance?
(4) Do we move new proposals https://github.com/mathml-refresh/mathml-css-proposals to CSS -drafts?. Per https://lists.w3.org/Archives/Public/public-mathml4/2019Mar/0007.html for mathvariant it seems fine to extend CSS
text-transformanddisplaystyleis not really controversial. I hope we can decide about scriptlevel-related properties in the next meeting.dani31415 commentedon Mar 15, 2019
I think we should make MathML core as much backward compatibility as possible with existing formulas. With this idea we should implement the
<mstyle>.At the same time I would deprecate
<mstyle>in the sense that we recommend to use the alternative version of<mrow>with CSS. In addition, in MathML 4, I would deprecate<mstyle>as well (with the same meaning of a recommendation of not to use it).fred-wang commentedon Mar 19, 2019
cc @rwlbuis @emilio
We have discussed a lot about scriptlevel yesterday. This is my summary regarding the attributes:
scriptlevel,scriptsizemultiplierandscriptminsizewhich means we would need to map attributes to CSS or replace them with something known by CSS.scriptsizemultiplierandscriptminsizein an arbitrary place is not very useful (but if we map them to CSS that would still be possible anyway). In general some people think it does not make sense to configurescriptsizemultiplierandscriptminsizevalues at the MathML markup level, there should be another more modern way to address these use cases.scriptsizemultiplierfeature could be replaced with OpenType MATHscriptPercentScaleDownandscriptScriptPercentScaleDownconstants which are likely accessible from the CSS engine and correspond more to the font designer's goal. Other levels are less important in practice (e.g. TeX and Microsoft office don't consider them) so we could keep the constant 0.71 or do another kind of extrapolation. See https://github.com/mathml-refresh/mathml-css-proposals/blob/master/math-script-level-and-math-style-comments.md#opentype-math-values-scriptpercentscaledown-and-scriptscriptpercentscaledownscriptminsizefeature could probably be replaced with CSS's newfont-min-sizeproperty ( https://drafts.csswg.org/css-fonts-4/#propdef-font-min-size ). Note that this is not exactly the same, sincescriptminsizeis only supposed to affect the change due to scriptlevel, so we cannot just map tofont-min-size. However, I believe it still addresses the use cases for whichscriptminsizewas introduced.Given all of this, I would now recommend to remove
scriptsizemultiplierandscriptminsizeattributes from MathML Core and only keep thoses:Details for the last one still have to be discussed in #31
fred-wang commentedon Mar 22, 2019
@brucemiller mentioned that LaTeXML sometimes generates href on mstyle ( #55 (comment) ).
First, I'd like to clarify that this proposal is not about generic MathML attributes on mstyle ( like https://mathml-refresh.github.io/mathml/chapter2.html#fund.globatt or https://mathml-refresh.github.io/mathml/chapter3.html#presm.presatt ) but only about those related to this MathML 3 "inheritance".
Also, this raises yet another issue with the MathML 3 mstyle model. https://mathml-refresh.github.io/mathml/chapter3.html#presm.mstyle already has an exception for mathbackground/mathcolor saying that it applies to the mstyle itself, not to descendants. Such an exception should also apply to href.
31 remaining items
fred-wang commentedon Aug 19, 2020
This github comment is not complete, the proposal was #1 (comment) and summary says
which is what we've try to do in the spec/tests/implementation.
Two points:
AFAIK MathJax (and so wikipedia) does not use Unicode characters, but the mathvariant attribute instead. And there are others tools using mstyle@mathvariant (like itex2MML). So we would need to convince them first or claim polyfill is good enough in that case.
As discussed during core meeting, restricting to token elements actually makes things more slightly complicate for browsers since you need to perform per-tag check and have the corresponding tests to check attributes apply to a specific list of elements. So I still don't understand what's the point of doing that? The only explanation is #204 but it can be solved by introducing universal selector, if it's considered a bug rather than a feature. I also prefer consistency and say that "MathML stylistic attributes apply to all mathml elements and are just mapped to CSS properties" which is easy to understand.
We definitely need automatic mathvariant italic in any case for single-char mi. If the CSS WG rejects or wants change to mathvariant or other proposals then we can adapt accordingly, but I don't think we need to agree before we actually get their feedback. Also IIUC Brian said our text-transform proposal is uncontroversial in the CSSWG now. I think the risk is more on the scriptlevel stuff.
Remove unnecessary explicit parsing for mo@maxsize value "infinity"
NSoiffer commentedon Dec 19, 2024
I think the "needs resolution" and "needs specification update" labels can be removed, leaving only the need to implement the polyfill.
@fred-wang, @davidcarlisle: agree?
davidcarlisle commentedon Mar 15, 2025
This is a very old issue, just reviewing the current state, mostly mathml4 presentation follows core and makes the relevant attributes valid on all elements. Assuming #531 is merged
<mstyle>is the same as<mrow>except that it allows 4 additional attributes (that are not in Core) as such it can't really be simplified a lot more unless we drop it completely. Although we could make those 4 attributes "attributes common to presentation elements" and just saymstyleis the same asmrowkept for legacy reasons.So in answer to @NSoiffer's comment above, we could leave specification as is (and remove the label) or simply further.
Bug 1581726 [wpt PR 19110] - Add MathML tests to check that legacy ms…
davidcarlisle commentedon Jul 3, 2025
Consensus at meeting today was to consider moving towards core and allow displaystyle and other attributes on all presentation elements, this would affect the details here. To be investigated Note the spec already says this in https://w3c.github.io/mathml/#presm_presatt_core but is not consistently carried through the rest of the spec.
Note
decimalpointattribute can be droppedNSoiffer commentedon Nov 11, 2025
Changing the spec is looking more complicated than I first thought. Unlike core, full has content and presentation elements. In particular, we have 3.1.9 Mathematics attributes common to presentation elements. That's probably where the majority of the contents of mstyle should move to. Not to Chapter 2 which talks about attributes common to all elements. That section probably needs to be updated to brought into sync with core (I think there are a few differences)
But mstyle also says:
That's a difference from what core does, so we can't say that in full, mstyle is the same as mrow as is done in core.
Also, contrary to what is said in #1 (comment),
decimalpointcan't be dropped. "decimalpoint" is a somewhat misleading name as it isn't about alignment: it specifies the character to use for decimal alignment if that is chosen (with the malign deletion, only relevant to mstack'sstackalignattr if the value is "decimalpoint"). Potentially it should be renamed to "decimalcharacter" to avoid confusion with the attribute value.davidcarlisle commentedon Nov 11, 2025
yes exactly, that is also the way the schema handles it,
https://www.w3.org/TR/mathml4/#parsing_rnc_core
Global attributes in core are the list
MathMLPGlobalAttributeswhich is included into the presentation mathml schema (not content mathml) at https://www.w3.org/TR/mathml4/#parsing_rnc_pres which extends it in various ways egto add
hrefbut that list is still included into all presentation elements both from core and ones added in mathml full.So I'd expect to add
decimalpointthere, which would equate to adding it to 3.19 as you state.I don't find it too confusing to have
decimalpointboth as an attribute and an attribute value, but as you say current use isn't that great so we could rename the attribute, and keepdecimalpointjust as the name of the alignment to go in attribute values.Move the mstyle attributes to attrs common to all presentation elemen…
Move the mstyle attributes to attrs common to all presentation elemen…
davidcarlisle commentedon May 31, 2026
@NSoiffer is this now covered by the polyfills?
NSoiffer commentedon Oct 22, 2026
Wrote a polyfill last week, so this can be closed.