sile-typesetter / sile

The SILE Typesetter — Simon’s Improved Layout Engine
https://sile-typesetter.org
MIT License
1.67k stars 99 forks source link

Math "accents" (for vectors, hats etc.) are not properly supported #2150

Open Omikhleia opened 4 weeks ago

Omikhleia commented 4 weeks ago

Dear SILE 0.15.5 math enthusiasts,

Let's say you want to typeset a vector $\vec{v}$ (with a nice top arrow) in SILE, or a variable with a fancy hat $\hat{n}$, or a long vector $\overrightarrow{AB}$...

How would you do that?

Quick answer: you can't.

I am not discussing here the issue of stretchy operators, which is a different topic[^1] ... but the correct positioning of accents on top of or under other elements...

And as shown in this issue description here, GitHub is not bad at it. So? :pig_nose: How hard can it be for such an advanced typesetting system as SILE? :clown_face:

[^1]: See #2148 (although the case here would be on horizontal stretching... erm...)

MathML

One is supposed to use <mover>, <munder>, <munderover> to attach accents to other elements, with specific attributes ("accent" and/or "accentunder", see references below). EDIT: And one might not even have to use them for operator symbols in a pre-defined table, where defaults may apply.

For instance,

Try these, and see how SILE currently handles them. The "accent" attribute is not supported, and the position of the accent somewhat off.... From a quick analysis, SILE's OpenType parser is handing the corresponding MATH features, so it would be at hands...

References:

TeX-like math

In LaTeX, one would use \vec{v}, \hat{n}, \overrightarrow{AB} etc.

What does these produce in SILE? Let's try. The commands are recognized, defaulting to atoms. The argument is lost without warning, and the output is not what one would expect. Of course, adding a custom \def to handle the mapping to MathML would be possible... But it then falls on the same issue as above.

TL;DR