Skip to content

Definition of cramped elements for overscript #134

Closed

Description

@fred-wang

https://mathml-refresh.github.io/mathml-core/#cramped-elements

It has "It is the overscript of the <mover> and <munderover> elements and is an embellished operator with the accent property."

This case is probably not very useful in practice. Cramped is used to calculate superscript shifts and elements with a superscript are rarely an "embellished operator with the accent property". Rather, the most common case is when the mover/munderover element have an accent="true" attribute, which is not mentioned here but supported by Gecko. (Related discussion for scriptlevel: #76 )

Additionally, this rule should probably not apply when the overscript child is actually rendered as a superscript (i.e. the base has movablelimits and displaystyle is false). Gecko does not seem to have a special case for that.

Activity

  1. added
    MathML Core
    need resolution
    need specification update
    need tests
    opentype / tex
    on Sep 13, 2019
  2. NSoiffer commented on Nov 4, 2019

    @NSoiffer
    Contributor

    I think the core spec is wrong and should be changed in this case. If you look at the MathML 3 spec, displaystyle is always set to false within the overscript, hence the overscript is always in a cramped style. The accent property does not affect this. The accent property changes whether the scriptlevel changes or not.

    Note: if we start with displaystyle="true" and scriptlevel=0, then the overscript is set with displaystyle="false" and scriptlevel=0, which should result in a cramped layout.

    What does change however is that accents should be placed closer to the base than non-accents. TeX has a special rule for this (step 12) and from my brief review, that rule makes use of cramped style but also uses other rules.

  3. fred-wang commented on Nov 4, 2019

    @fred-wang
    Author

    Currently MathML Core spec uses the "cramped" definition from Gecko which has nothing to do with displaystyle.

  4. NSoiffer commented on Nov 10, 2019

    @NSoiffer
    Contributor

    I take back what I said about TeX making use of the cramped style. Also about what MathML 3 says. Here's a bit of a deep dive...

    Seems like we have three options:

    1. Follow the MathML 3 spec (which leaves a lot to the imagination :-)
    2. Follow TeX
    3. Follow Gecko or some other implementation

    MathML Spec

    The spec is vague on details. The main statement I found is:

    The displaystyle affects the amount of vertical space used to lay out a formula: when true, the more spacious layout of displayed equations is used, whereas when false a more compact layout of inline formula is used. This primarily affects the interpretation of the largeop and movablelimits attributes of the mo element. However, more sophisticated renderers are free to use this attribute to render more or less compactly.

    And the rule for mover says:

    It always sets displaystyle to "false" within overscript, but increments scriptlevel by 1 only when accent is "false". Within base, it always leaves both attributes unchanged.

    Basically, no real guidance on detailed vertical spacing other than vertical spacing is potentially reduced in the overscript.

    TeX

    There is not a 1-1 mapping of mover to TeX rules. The two most relevant rules are the ones for over atoms (from \overline, rule 9) and from acc atoms (from \mathaccent, rule 12). Neither of these allow anything complicated in the script position, so they are similar to mover only for the simple, common cases.

    Note: the equivalent to \overline in MathML is to use a character such as _, as the second arg and the operator dictionary defines that as an accent. So rules 9 and 12 correspond to accent='true'.

    Rule 9 sets the base in the current style, lays out the box with the overline using only info about the default rule thickness (i.e., cramped style is not relevant). This new box get the current style.

    Rule 12 sets the base in a cramped style. Any sub/superscripts on the acc atom are sucked into the base and set in the current style. The accent is positioned and all the contents are put in a vbox. Rule 12 doesn't say what style the vbox is in; I assume it is the current style.

    Because the accent (or overline) is a single character, TeX is essentially silent on how an accent should be typeset if the accent is subject to the vertical spacing rules (i.e., cramped styles are only tested for super scripts [rule18c]). I think the closest analogy in TeX then is what TeX does for superscript: TeX sets the superscript in a smaller font, but does not force it to be a cramped style (rule 18c). Also, the nesting is different in MathML and TeX, if a complicated overscript is attempted in TeX, it would be done to the result of the accent or overline box, and those are both set in the current style, not forced to be a cramped style.

    Firefox

    @fred-wang said that rules in the core spec come from the Firefox implementation. In particular, a comment above references this comment in the code:

    A frame becomes "compressed" (or "cramped") according to TeX rendering rules (TeXBook, Ch.17, p.140-141).

    I believe this is a misreading of this sentence in the TeX book towards the bottom of p141:

    Math accents, and the operations \sqrt and \overline change uncramped styles to their cramped counterparts.

    This sentence (and the actual rules, see above) change the style of the base, not of the accent char/overline; those are simply characters and whether they are cramped/uncramped will never matter.

    My conclusion

    Because MathML doesn't say anything and because Firefox's rendering is based on a misunderstanding of the TeX spec, we should go with what TeX does... But TeX's constructs don't directly map to MathML's mover element. However, the closest analogy would be superscripts, and superscripts in TeX are not forced to be a cramped style. Hence, I think this clause ('6') can be removed entirely so that the overscript in mover and munderover does not force cramped style.

  5. fred-wang commented on Nov 10, 2019

    @fred-wang
    Author

    Thanks @NSoiffer ; OpenType MATH also has a notion of "cramped style" ( see superscriptShiftUpCramped in https://docs.microsoft.com/en-us/typography/opentype/spec/math ) ; Can we get more information from Microsoft?

    This is where COMPRESSED is used in Firefox:
    https://searchfox.org/mozilla-central/search?q=NS_MATHML_COMPRESSED
    https://searchfox.org/mozilla-central/search?q=NS_MATHML_IS_COMPRESSED

    Personally, I don't have strong preference but I'm always in favor of simplifying things and removing what is not fundamental. So I'm happy if we remove close 6. I think @emilio would like it, especially if we can then just define "cramped" as a CSS property (issue #164). Also a CSS property would allow authors to control the cramped notion, if they disagree with the default provided by MathML.

  6. fred-wang commented on Nov 12, 2019

    @fred-wang
    Author

    Consensus from 2019/11/11: Remove special case for overscripts.

  7. removed
    need resolution
    need specification update
    need tests
    on Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    MathML Coreopentype / tex

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions