Skip to content

Remove/Deprecate mfrac@bevelled #29

Closed

Description

@fred-wang

Just opening for discussion. I wonder if this is really used in practice.

Activity

  1. added
    MathML 4
    on Feb 22, 2019
  2. davidcarlisle commented on Feb 22, 2019

    @davidcarlisle
    Collaborator

    The equivalent layout in tex is provided by several popular packages, nicefrac, xfrac for example. Not used so much in scientific documents but quite a lot for fractions in other fields. Arguably of course in a web context one should use characters such as ¾ rather than constructed fractions for many of these uses, but still mapping between TeX and MathML is easier with this in, I think.

  3. fred-wang commented on Feb 22, 2019

    @fred-wang
    Author

    Thanks for the info.

  4. dani31415 commented on Feb 25, 2019

    @dani31415

    I understand that it is difficult to implement. But since we have the icon in MathType, I assume some people are using it.

  5. fred-wang commented on Mar 14, 2019

    @fred-wang
    Author

    I understand that it is difficult to implement.

    It's not really about the difficulty to implement but about
    (1) implementing in a way that is compatible with web engines's layout approach.
    (2) not adding extra code/complexity or duplicate features to web engines if it has limited usage. Again we need #55


    cc @rwlbuis, @emilio :

    Currently it's only implemented in Gecko. Regarding (1), the issue is that the width of the slash might strongly depend on the vertical metrics of numerator/denomiator preventing to get accurate intrinsic widths. See https://dxr.mozilla.org/mozilla-central/source/layout/mathml/nsMathMLmfracFrame.cpp where intrinsic width and actual width calculation differ:

     // Set the width of the slash
     if (aWidthOnly) {
       mLineRect.width = mLineThickness + slashMaxWidthConstant;
     } else {
       mLineRect.width =
           mLineThickness +
           std::min(slashMaxWidthConstant,
                    (mBoundingMetrics.ascent + mBoundingMetrics.descent) /
                        slashRatio);
     }
    

    We have a similar issues for vertical stretchy operators, but at least the width generally does not depend too strongly on the height so it's acceptable to take the max widths for preferred width calculation... except of course for U+2044 FRACTION SLASH !!

    The equivalent layout in tex is provided by several popular packages, nicefrac, xfrac for example. Not used so much in scientific documents but quite a lot for fractions in other fields. Arguably of course in a web context one should use characters such as ¾ rather than constructed fractions for many of these uses, but still mapping between TeX and MathML is easier with this in, I think.

    In general one can probably implement the slash fraction layout <mpadded>NUMERATOR</mpadded><mo>&#x2215;</mo><mpadded>DENOMINATOR</mpadded></mrow> with some mpadded attributes to adjust the position of numerator and denominator. This suggests that (1) duplicates existing features (2) could be implemented via polyfills ; hence should not be in core.

  6. added
    compatibility
    on Mar 20, 2019
  7. NSoiffer commented on Apr 29, 2019

    @NSoiffer
    Contributor

    According to the stats we have so far, the DLMF and arXiv converters don't support it and NAG doesn't use it. However, I've seen it many times in textbooks. I think we should defer a decision until we get stats from Pearson. That represents a group where I think it is used, but the stats may say something different.

  8. added
    need resolution
    on May 16, 2019
  9. davidcarlisle commented on Jun 12, 2019

    @davidcarlisle
    Collaborator

    I think bevelled is only really used for small fractions in mostly non technical works and is essentially the same usage as U+2044 (fraction slash)

    123⁄456

    Seems to be supported by most browsers (well chrome and firefox at least) and I'd be happy if core only supported this for the case of mfrac with two token elements and

    <mfrac type="bevelled"><mn>123</mn><mn>456</mN></mfrac>

    was treated as

    <mn>123⁄456</mn>

    In which case it might be cleaner if core didn't support mfrac bevelled at all, and that mapping was left to convertors from full.

  10. added
    need specification update
    need tests
    on Sep 17, 2019
  11. 21 remaining items

  12. brucemiller commented on Feb 17, 2020

    @brucemiller
    Contributor

    Some initial observations: Your examples seem quite sensible for bevelled fractions. I checked these cases in both text and display using

    • LaTeX nicefrac.sty
    • Xelatex xfrac.sty (using URW Bookman light)
    • MathML bevelled mfrac in Firefox and Chrome+MathJax
      All cases look pretty reasonable except that Firefox & MathJax lower the denominator (as per the spec), whereas the TeX versions dont, leaving the denominator essentially aligned to the baseline. (The latter looks best, imho). Also, in display Firefox is a bit too generous with the shifts.

    I then pushed the envelope a bit where bevelled normally wouldn't be used to check for reasonable (if not beautiful) as opposed to downright ugly. I used for numerator & denominator small fractions (like \frac{1}{2}) and 3 row matrices. Here nicefrac & MathJax are still reasonable. xfrac strangely shifts the numerator down. Firefox shifts both the numerator up and the denominator down way too much.

    Hopefully those descriptions can help guide to testcases; I don't want to bombard with images till we settle a bit.

  13. brucemiller commented on Feb 24, 2020

    @brucemiller
    Contributor

    Sorry, running out of time to chop up 50+ images, but let's try the following. The samples are Neil's from above and two taller ones containing fractions and vectors; all are shown in inline and then in display. Each group is rendered using LaTeX's nicefrac (from pdf): mfrac with bevelled true in Firefox and Chrome with MathJax. Note that the images are getting shrunk to fit the table (you can click each image for fullsize)

    nicefrac Firefox MathJax
    nicefrac mfrac-firefox mfrac-mathjax

    The following is using a proposed mrow equivalent (corrected
    mrow-firefox
    version)

  14. NSoiffer commented on Feb 24, 2020

    @NSoiffer
    Contributor
  15. bruce commented on Feb 24, 2020

    @bruce

    @NSoiffer 👋 You probably meant to tag @brucemiller.

  16. brucemiller commented on Feb 26, 2020

    @brucemiller
    Contributor

    Here's the pages (bev-mfrac.html is probably what you want)
    bev.zip

  17. MurraySargent commented on Mar 16, 2020

    @MurraySargent

    Here are images of Bruce's beveled fractions in OfficeMath (Word, PowerPoint, OneNote,...)
    BevelledFractionsInOfficeMath

  18. added
    need polyfill
    on May 18, 2020
  19. NSoiffer commented on May 18, 2020

    @NSoiffer
    Contributor

    Based on what @brucemiller found, it seems we don't need to measure to do the layout, so a polyfill becomes much more reasonable. I have added the 'need polyfill' label.

  20. removed
    need polyfill
    on Jun 3, 2020
  21. removed
    need resolution
    on Aug 12, 2020
  22. removed
    need specification update
    on Aug 8, 2024
  23. davidcarlisle commented on Aug 8, 2024

    @davidcarlisle
    Collaborator

    Closing as bevelled will be kept in full (and dropped in core)

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 4compatibilityneed tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions