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
Consider defining "cramped" as a CSS property? #164
This will allow people to force cramped style in MathML or their custom layout.
As discussed in #134 and similarly to the discussion with scriptlevel, this assumes we exclude the case when the "accent" property is determined from the operator dictionary / text content of the core operator.
Current definition uses "second in-flow child" so I don't think that works with CSS (we can probably change it, we have the same issue with script-level increment anyway).
Current definition does not include (post?)subscripts of mmultiscripts (following Gecko). These are probably more difficult to describe with CSS.
Anyway, I don't think making cramped a CSS property is something urgent.
* Current definition uses "second in-flow child" so I don't think that works with CSS (we can probably change it, we have the same issue with script-level increment anyway).
* Current definition does not include (post?)subscripts of mmultiscripts (following Gecko). These are probably more difficult to describe with CSS.
Anyway, I don't think making cramped a CSS property is something urgent.
Even if we don't define cramped as a CSS property yet, addressing the two points above would be helpful to make cramped more aligned with the rest of the LayoutNG code.
[updated]
At the MathML core meeting today, there was some confusion (by me and others) about what cramped style is. Looking at TeX, cramped style:
only affects super script positioning.
is (initially) acquired in a sub script, an accent (in TeX, "math accent" and overline), the denominator in a fraction, and in a sqrt/radical.
is inherited once acquired.
In the meeting, the question arose as to whether multiscripts need to set in a cramped style. I think the answer is "yes", but since multiscripts want to set all of their sub/superscripts at the same vertical offset (respectively), I'm not sure cramped style makes sense for the multiscript superscripts to use a cramped style since they want to be raised a little above normal so that a "+" or other symbol doesn't cause one superscript to shift up but not another. On the other hand, since multiscripts can look at all the scripts, it could set them all in a cramped style if all of them use the same vertical offset. So the answer really comes down to what the layout rules are for multiscripts.
Note: see #134 (comment) for details on how TeX does cramped computation.
you miss one more case where TeX uses a cramped style, it is used
denominators of fractions in display and cramped display style (rule 15a)
luatex adds four primitives to explicitly set the four cramped versions of
the math styles
\crampeddisplaystyle
\crampedtextstyle
\crampedscriptstyle
\crampedscriptscriptstyle
these act like the standard \scriptstyle etc, but select the cramped forms.
mmultiscripts will definitely use the scriptshiftup parameters for the layout of all the superscripts. However, the question is whether it changes the cramped style for subscripts, and this will then affect how the layout of superscript is done for any descendants (at arbitrary deep level) of these subscripts.
I believe that cramped style should be set for the subscripts in multiscripts. Hopefully that is doable as per @fred-wang's idea in the call today.
After my comment about about looking at all of the children to determine alignment, I looked at the MathML 3 and core specs. One of the few things where MathML 3 says something about layout is that all the sub/superscripts (respectively) are aligned. The core spec respects that, although I think the wording can be improved:
SubShift (respectively SuperShift) is calculated by taking the maximum of all subshifts (respectively supershifts) of each subscript/superscript pair as described in § 3.4.2.4 Base with subscript and superscript.
The rest of the section then uses SubShift (respectively SuperShift). The issue I have is that "SubShift" is defined earlier ($3.4.2.3) and this part of the spec redefines it, which can cause confusion. E.g., here's part of the description of layout:
Place the subscript (respectively superscript) so its alphabetic baseline is shifted away from the alphabetic baseline by SubShift (respectively SuperShift) towards the line-under (respectively line-over).
It is easy to miss that those value's meaning was changed a screen above. I think using "MaxSubShift" (and "MaxSuperShift") would avoid any confusion. The same is true for "line-ascent" and "line-descent".
Returning to this issue, I agree that nothing special wrt to superscript positioning and cramped style needs to happen with mmultiscripts -- the initial layout can follow the rules for msubscript. If taking the max among all the children doesn't change the shift amount from a default cramped layout, that's fine.
Activity
NSoiffer commentedon Nov 10, 2019
If we go with my suggestion in #134, the last two lines should be removed and this issue goes away.
fred-wang commentedon Nov 12, 2019
Consensus from 2019/11/11: Remove special case for overscripts.
This means we can implement it as a CSS property.
In a previous meeting, @bkardell pointed out that we should explain in English what "cramped" means. Apparently there is one cf definition 2 of https://www.dictionary.com/browse/cramped
[-]Consider defining a "cramped" as a CSS property?[/-][+]Consider defining "cramped" as a CSS property?[/+]fred-wang commentedon Jan 21, 2020
I simplified a bit the way the definition of cramped is written: https://mathml-refresh.github.io/mathml-core/#dfn-cramped
Anyway, I don't think making cramped a CSS property is something urgent.
fred-wang commentedon Mar 13, 2020
Even if we don't define cramped as a CSS property yet, addressing the two points above would be helpful to make cramped more aligned with the rest of the LayoutNG code.
NSoiffer commentedon Mar 23, 2020
[updated]
At the MathML core meeting today, there was some confusion (by me and others) about what cramped style is. Looking at TeX, cramped style:
In the meeting, the question arose as to whether multiscripts need to set in a cramped style. I think the answer is "yes", but since multiscripts want to set all of their sub/superscripts at the same vertical offset (respectively), I'm not sure cramped style makes sense for the multiscript superscripts to use a cramped style since they want to be raised a little above normal so that a "+" or other symbol doesn't cause one superscript to shift up but not another. On the other hand, since multiscripts can look at all the scripts, it could set them all in a cramped style if all of them use the same vertical offset. So the answer really comes down to what the layout rules are for multiscripts.
Note: see #134 (comment) for details on how TeX does cramped computation.
davidcarlisle commentedon Mar 23, 2020
fred-wang commentedon Mar 23, 2020
Where Gecko changes the cramped style: https://dxr.mozilla.org/mozilla-central/search?q=NS_MATHML_COMPRESSED
mmultiscripts will definitely use the scriptshiftup parameters for the layout of all the superscripts. However, the question is whether it changes the cramped style for subscripts, and this will then affect how the layout of superscript is done for any descendants (at arbitrary deep level) of these subscripts.
NSoiffer commentedon Mar 23, 2020
I believe that cramped style should be set for the subscripts in multiscripts. Hopefully that is doable as per @fred-wang's idea in the call today.
After my comment about about looking at all of the children to determine alignment, I looked at the MathML 3 and core specs. One of the few things where MathML 3 says something about layout is that all the sub/superscripts (respectively) are aligned. The core spec respects that, although I think the wording can be improved:
The rest of the section then uses SubShift (respectively SuperShift). The issue I have is that "SubShift" is defined earlier ($3.4.2.3) and this part of the spec redefines it, which can cause confusion. E.g., here's part of the description of layout:
It is easy to miss that those value's meaning was changed a screen above. I think using "MaxSubShift" (and "MaxSuperShift") would avoid any confusion. The same is true for "line-ascent" and "line-descent".
Returning to this issue, I agree that nothing special wrt to superscript positioning and cramped style needs to happen with mmultiscripts -- the initial layout can follow the rules for msubscript. If taking the max among all the children doesn't change the shift amount from a default cramped layout, that's fine.
fred-wang commentedon Mar 24, 2020
Here is an example using ~ and n-th child. We can do the same with color replaced with a cramped property.
15 remaining items
Bug 1630861 [wpt PR 23046] - Update links for cramped and remove OOF …
Bug 1630861 [wpt PR 23046] - Update links for cramped and remove OOF …
Bug 1630861 [wpt PR 23046] - Update links for cramped and remove OOF …
Bug 1630861 [wpt PR 23046] - Update links for cramped and remove OOF …
Bug 1630861 [wpt PR 23046] - Update links for cramped and remove OOF …
Bug 1630861 [wpt PR 23046] - Update links for cramped and remove OOF …
Bug 1630861 [wpt PR 23046] - Update links for cramped and remove OOF …
Bug 1630861 [wpt PR 23046] - Update links for cramped and remove OOF …
fred-wang commentedon May 22, 2020
There is now https://mathml-refresh.github.io/mathml-core/#the-math-superscript-shift-style which is tested in WPT and implemented in Chromium upstream, so closing
Bug 1630861 [wpt PR 23046] - Update links for cramped and remove OOF …
Bug 1630861 [wpt PR 23046] - Update links for cramped and remove OOF …