Skip to content
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

How is inline stretch size constraint determined? #270

Open
brucemiller opened this issue Dec 14, 2024 · 4 comments
Open

How is inline stretch size constraint determined? #270

brucemiller opened this issue Dec 14, 2024 · 4 comments

Comments

@brucemiller
Copy link

How is the inline stretch size constraint (ie. the target width for a horizontally stretchy operator) determined? At https://w3c.github.io/mathml-core/#dfn-inline-stretch-size-constraint, we say "During box layout, optional inline stretch size constraint and block stretch size constraint parameters may be used on embellished operators.". However, I can not find where it says how this parameter is determined, or if (& how) we can affect it. (There is an open issue #64 that suggests minsize/maxsize might be applicable, but resolution has been deferred).

In experiments, I can only see horizontal stretch happening within mover (& friends), but not in mpadded or mtable, for example.
The target application is commutative diagrams, which will appear within an mtable. It would be acceptable to specify an explicit length for the arrows, if they could stretch at all; but it seems perverse to wrap arrows with an extra mover and empty (but wide!) script just to get the arrow length.

@fred-wang
Copy link
Contributor

It's set in this algorithm. If you click the bold text, you see it's called from munder, mover and munderover. To make things work with embellished operators, the "inline stretch size constraint" can be passed recursively to the child containing the core operator.

The part about mtd from MathML3 is currently not supported in MathML Core. In general mtable support is very limited in level 1 (issue #125). As a rough sketch, we would probably need to change the table algo to first do a layout without inline stretch size constraint, and then a second layout passing a maximum of inline size of the content in the same column. Similarly for stretching in the block direction. Obviously, there are probably a lot of details and egde cases to think about...

Issue #138 is about exposing this to polyfills relying on the CSS layout API.

@brucemiller
Copy link
Author

brucemiller commented Dec 14, 2024

Ah, thanks for the clarification. So, that algorithm is part of the description of munder, which is helpful once you've realized that horizontal stretch is only happening there :> Perhaps it would be good to link there from the mo description?
I wasn't too surprised that mtables didn't (yet) work, but I was that mpadded didn't:

<math>
<mpadded width="3em">
   <mo>→</mo>
</mpadded>
</math>

But perhaps I should be surprised there either, since I suppose that never has worked. But should it?

@fred-wang
Copy link
Contributor

What do you mean for mpadded?

The example you mentioned shouldn't stretch by itself.

If you are saying that, as an embellished operator, it should stretch when placed in an munderover-like construct, then the answer is yes.

However, I just checked and that does not work in Chromium:

<!DOCTYPE html>
<meta charset="utf-8">
<link
  rel="stylesheet"
  href="https://fred-wang.github.io/MathFonts/STIX/mathfonts.css"/>
<math>
  <munder>
    <mpadded>
      <mo>→</mo>
    </mpadded>
    <mtext>blahblahblah</mtext>
  </munder>
</math>

Probably, https://w3c.github.io/mathml-core/#layout-of-mpadded should say that the anonymous mrow box is laid out using the same inline/block stretch constraint and Chromium does not do that.

@brucemiller
Copy link
Author

I just editted the previous example to wrap with <math> to clarify that I was hoping that that construct, or something like it, would display the arrow 3 ems long. In particular, without any containing munder. After all, an operator without any embellishment is still an "embellished operator".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants