-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more details to the stretchy algorithm #238
Comments
Tex does (2) stop at (and use) first characterthat is at least the requested size. Note tex ony ever stretches symmetrically on the math axis so size here is effectively height+depth. The texbook describes it thus:
Not really. there is no factor built in there are two user settable parameters
latex sets these to
so at least 90.1% of the size and within 5pt of the size, but that is settable at any point and can be changed for each expression within a document it is not built in to tex.
All this is just about Classic TeX can not horizontally stretch characters. Some wide accents choose from a fixed set by measuring "by hand" within the macro layer and then stretchy arrows just draw horizontal or vertical rules, not using glyphs apart from the arroew head. |
MathML Core says we should pick first size that is at least the target size (so 2 above). Besides what David explained, there are two (arguably not very strong) hints that justify this choice:
Regarding implementations, Chromium and WebKit tries to find at least the target size. Gecko is doing more complicate stuff, but IIUC
It's actually doing even more, see stretch hints (see also IsSizeOK, IsSizeBetter and GetStretchHint) for details. Also by default the My preference would be to keep the algorithm simple as it's easier to understand (especially when writing or debugging WPT tests). If we really want something like delimiterfactor or delimitershortfall prefs, it would be better to have them as CSS properties (so that web developers can customize them if needed) rather than hardcoded magic values. I assume they would be defined as percentage and length respectively and could take different values for the element stretching the embellished operator, the embellished operator and the core operator (so we would need to decide which of the three possibilities to consider). |
Small update from the MathML Full meeting on 18/4/24: @davidcarlisle pointed out that |
I understand this would mean tweaking https://w3c.github.io/mathml-core/#dfn-shape-a-stretchy-glyph so that steps 2 and 3 are changed by at least 90.1% of T when shaping to block dimension T. |
This comes from a side discussion about #103... It incorporates two related questions about the algorithm for stretchy characters.
Some stretchy characters have a few fixed sizes before moving to essentially assembling glyph pieces. For these fixed sizes, there is the question of which glyph variant to choose when the size is between two sizes. I see three options when moving from smaller sizes to larger sizes:
Note that the target size is affected by the symmetric property.
@davidcarlisle: what does TeX do?
My gut reaction is that choosing the closest size is best. However, I'm not entirely sure that is right or maybe the target size should have already been shrunk (TeX uses parens/brackets/braces that are ~90% the size of the contents for
\left( ... \right)
-- see below).5.3 Size variants for operators (MathVariants) says:
So the spec seems to be saying use '2'. I didn't see an issue where there a discussion of what is the right thing to do (hence this issue).
The determination of the target size is in 3.3.1.1 Algorithm for stretching operators along the block axis.
TeX has:
\delimitershortfall
: specifies the maximum space not covered by a delimiter (default 5pt)\delimiterfactor
: the ratio for variable delimiters, times 1000 (default 901).I suspect that sizing will be better if we follow the TeX model. This would mean a change to 3.3.1.1. I don't know how common it is to change these values. Maybe @dginev can tell from arXiv? Assuming changing them is not common (and they aren't in the OpenType table), then I suggest hard coding them into the algorithm in the spec for computing the size to use.
@davidcarlisle: are these variables used for other stretchy chars like
\sum
and horizontal stretching, or just when\left
and\right
are used (which would slightly complicate the algorithm by having to check the first/last element in an mrow for being a prefix/postfixmo
.The text was updated successfully, but these errors were encountered: