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
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.
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
// 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>∕</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.
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.
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
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.
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
The following is using a proposed mrow equivalent (corrected
version)
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.
Activity
davidcarlisle commentedon Feb 22, 2019
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.
fred-wang commentedon Feb 22, 2019
Thanks for the info.
dani31415 commentedon Feb 25, 2019
I understand that it is difficult to implement. But since we have the icon in MathType, I assume some people are using it.
fred-wang commentedon Mar 14, 2019
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:
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 !!
In general one can probably implement the slash fraction layout
<mpadded>NUMERATOR</mpadded><mo>∕</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.NSoiffer commentedon Apr 29, 2019
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.
davidcarlisle commentedon Jun 12, 2019
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.
Add tests for MathML features that we might remove from Core / unship…
Add tests for MathML features that we might remove from Core / unship…
Bug 1585419 [wpt PR 19450] - Add tests for MathML features that we mi…
Bug 1585419 [wpt PR 19450] - Add tests for MathML features that we mi…
21 remaining items
brucemiller commentedon Feb 17, 2020
Some initial observations: Your examples seem quite sensible for bevelled fractions. I checked these cases in both text and display using
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.
brucemiller commentedon Feb 24, 2020
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)
The following is using a proposed mrow equivalent (corrected

version)
NSoiffer commentedon Feb 24, 2020
bruce commentedon Feb 24, 2020
@NSoiffer 👋 You probably meant to tag @brucemiller.
brucemiller commentedon Feb 26, 2020
Here's the pages (bev-mfrac.html is probably what you want)
bev.zip
MurraySargent commentedon Mar 16, 2020
Here are images of Bruce's beveled fractions in OfficeMath (Word, PowerPoint, OneNote,...)

NSoiffer commentedon May 18, 2020
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.
NSoiffer commentedon Jun 3, 2020
I've written a polyfill for this: https://github.com/mathml-refresh/mathml-polyfills/tree/master/bevelled
davidcarlisle commentedon Aug 8, 2024
Closing as bevelled will be kept in full (and dropped in core)
Bug 1585419 [wpt PR 19450] - Add tests for MathML features that we mi…