Open xworld21 opened 3 months ago
@xworld21 I think Firefox is behind on the CSS support for MathML. At the moment Chrome is the main browser that has existing support for CSS+MathML, and the community is pending some interop focus (and funding) to get the others in line.
That said, vertical-align
is actually specified only for a limited number of display contexts. Quoting MDN:
The vertical-align CSS property sets vertical alignment of an inline, inline-block or table-cell box.
If we have a need to use it over MathML (display: inline math;
and display: block math;
), I suspect we'd need to lobby the CSS group for an extension to vertical-align
. Which is a steep hill to climb, typically.
Edit: But there is a chance I am missing subtleties about how the inline
and block
adjustments to math
fit in with the traditional contexts.
Also, could you add the TeX source for the XY diagram screenshots you shared here, so that we can test and discuss the same conversion example? I got curious how the concrete XML looks like with the changes.
Likely it's too early for me to ask for turning it into a test, since Bruce should opine if the strategy has legs to run on.
That said,
vertical-align
is actually specified only for a limited number of display contexts. Quoting MDN:The vertical-align CSS property sets vertical alignment of an inline, inline-block or table-cell box.
Oh, I think I have figured this one out. In Chrome, the children of <mtext>
have an unmodifiable display: block
. Changing <mtext>
to display: inline
(or block
, inline-block
) reverts to the normal behaviour, where the SVG element is inline
and can be vertically aligned.
I have just checked MathML Core, and I believe Safari is getting it right, because
[...] the
mtext
element is laid out as a block box
which I read as saying that it should work as normal HTML. So this may well be a Chrome bug.
Fix #2376 for xy pictures. This requires XSLT changes because setting the correct
@viewBox
implies that vertical alignment must be done in CSS (as it should, so that text is placed correctly), hence we need to handle@imagedepth
.The change looks ok in very simple tests but it makes me a little nervous, because I don't quite understand the reasoning behind the original code and I might be breaking something. If you have a xy corpus, I can check it properly.
Source:
Before:
After (correctly mimicking LaTeX):
Vertical alignment is hit and miss when the SVG is nested inside MathML:
display: inline-block
ordisplay: block
to<mtext>
vertical-align
is completely ignored in MathML and I couldn't find a way to make it look right@dginev does the MathML spec say anything about
vertical-align
?