You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Supporting calc(100% + 0.333em) in the width attribute of <mpadded> #306
<mpadded> is only really useful for horizontal spacing when it's possible to add something to the width. For example, if one sets lspace on <mpadded> but does not change the width, then the lspace eats into the width of the content.
MathML 3 had the width="+0.333em" notation for this (with + as the prefix) but this was apparently replaced by a new notation in MathML 4, see this example:
The problem for MathML Core here is that the 100% here refers to the width of the child, and not to the width of the parent, as is the case in CSS.
But there is actually a solution in CSS, with the newly proposed calc-size function. The following actually works correctly in Chrome (which is the only browser currently implementing calc-size):
Thanks for this, It means that the example in the MathM4 draft is wrong (and I just confirmed it is as you say) so we should change that to use calc-size (probably with a warning that it's not generally implemented) I'm a bit confused as it's been in the draft for quite a while I'm sure we tested that at the time, but perhaps we were confused by the implementation status.
so the question would be whether we should allow length-percentage or calc-size everywhere that we currently allow length-percentage or just on mpadded (doing it for all length attributes seems more consistent)
support for calc(100% + 0.333em) is explicitly hard-coded in the spec and is internally translated to calc-size()
I'm not sure we need to do that, it seems just to be a spec error (in mathML4 draft) not something that needs to be supported.
During the MathML Core meeting yesterday this issue was discussed and I encountered the percentage widths being ignored in Chromium. I have now reread the related discussion in #183 that motivates that behavior.
Writing that in here, since I assume an mpadded width of calc() based on a percentage value will not be well-founded until #183 is resolved in some way.
Writing that in here, since I assume an mpadded width of calc() based on a percentage value will not be well-founded until #183 is resolved in some way.
Basing it on calc will indeed not work, as I show above in the first example. But, as I wrote after that, it does work when it's based on calc-size(). Your example works then:
@tmke8 yes calc-size works but there was feeling it was too early to suggest that as a general replacement at the current time as its implementation status is uncertain. We can always come back to that,
... If the width attribute is present, valid and not a percentage then that attribute is used as a presentational hint setting the element's width property to the corresponding value.
Activity
davidcarlisle commentedon Jan 6, 2026
Thanks for this, It means that the example in the MathM4 draft is wrong (and I just confirmed it is as you say) so we should change that to use calc-size (probably with a warning that it's not generally implemented) I'm a bit confused as it's been in the draft for quite a while I'm sure we tested that at the time, but perhaps we were confused by the implementation status.
so the question would be whether we should allow length-percentage or calc-size everywhere that we currently allow length-percentage or just on mpadded (doing it for all length attributes seems more consistent)
I'm not sure we need to do that, it seems just to be a spec error (in mathML4 draft) not something that needs to be supported.
dginev commentedon Jan 27, 2026
During the MathML Core meeting yesterday this issue was discussed and I encountered the percentage widths being ignored in Chromium. I have now reread the related discussion in #183 that motivates that behavior.
Here is a codepen example of what I witnessed:
https://codepen.io/dginev/pen/yyJPmBQ
Writing that in here, since I assume an mpadded width of
calc()based on a percentage value will not be well-founded until #183 is resolved in some way.tmke8 commentedon Jan 27, 2026
Basing it on
calcwill indeed not work, as I show above in the first example. But, as I wrote after that, it does work when it's based oncalc-size(). Your example works then:davidcarlisle commentedon Jan 27, 2026
@tmke8 yes calc-size works but there was feeling it was too early to suggest that as a general replacement at the current time as its implementation status is uncertain. We can always come back to that,
davidcarlisle commentedon Jan 27, 2026
@dginev I missed this during the meeting, but percentages not working for
widthis actually specified behaviour in core.https://www.w3.org/TR/mathml-core/#inner-box-and-requested-parameters