feat(math): Support MathML bevelled fractions #2165
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bevelled fractions (also known as skewed or diagonal fractions) are displayed with a slanted line (slash) instead of a horizontal bar.
Although this feature is still included in MathML4, it has been excluded from the MathML Core specifications.
As a result, most browsers are unlikely to support bevelled fractions...
But SILE is not a browser -- so it has the freedom to implement a broader standard! 🍰
As stated in the in-code comments, though, MathML4 does not exactly specify how to compute the layout, and the related OpenType math parameters are, at best, unclear1 -- and not pleasant looking; moreover there's no clear distinction for display / cramped / text modes... 🌵
So I went for my own interpretation, also looking at various TeX packages (nicefrac, xfrac) for references. I do like the result:2
Oh, as a final note -- I'm going to enter the debate on the
insaneglyph assembly logic once again... So yes, the proposed code draws a line. A mere line, of appropriate thickness (incl. the linethickness attribute when specified) 🍭Footnotes
After writing this, I found a ConTeXt manual (Hans Hagen & Mikael P. Sundqvist, Mathematics in ConTEXt, August 7, 2024 edition): SkewedFractionHorizontalGap and SkewedFractionVerticalGap "do not make sense (for us) so we do not use them." -- It's an interesting reading, by the way. ↩
I don't think lowering the fraction with respect to the baseline is the right thing to do. But see previous note: the mentioned ConTeXt book does it. Well, with plenty of other options etc. -- Likely beyond our own scope for now. ↩