tmke8 / latex2mmlc

https://tmke8.github.io/latex2mmlc/
MIT License
0 stars 0 forks source link

The symmetric operators that can be used as fences need to have set `form="prefix"` to have the correct spacing #290

Open tmke8 opened 1 week ago

tmke8 commented 1 week ago

Consider

\| \big\| \Big\| \bigg\| \Bigg\| \dots \Bigg| \bigg| \Big| \big| |

We currently render this as

<math display="block">
    <mi>‖</mi>
    <mo maxsize="1.2em" minsize="1.2em" stretchy="true" symmetric="true">‖</mo>
    <mo maxsize="1.623em" minsize="1.623em" stretchy="true" symmetric="true">‖</mo>
    <mo maxsize="2.047em" minsize="2.047em" stretchy="true" symmetric="true">‖</mo>
    <mo maxsize="2.470em" minsize="2.470em" stretchy="true" symmetric="true">‖</mo>
    <mo>…</mo>
    <mo maxsize="2.470em" minsize="2.470em" stretchy="true" symmetric="true">|</mo>
    <mo maxsize="2.047em" minsize="2.047em" stretchy="true" symmetric="true">|</mo>
    <mo maxsize="1.623em" minsize="1.623em" stretchy="true" symmetric="true">|</mo>
    <mo maxsize="1.2em" minsize="1.2em" stretchy="true" symmetric="true">|</mo>
    <mi>|</mi>
</math>

But this seems better:

<math display="block">
    <mo stretchy="false" form="prefix">‖</mo>
    <mo maxsize="1.2em" minsize="1.2em" stretchy="true" symmetric="true" form="prefix">‖</mo>
    <mo maxsize="1.623em" minsize="1.623em" stretchy="true" symmetric="true" form="prefix">‖</mo>
    <mo maxsize="2.047em" minsize="2.047em" stretchy="true" symmetric="true" form="prefix">‖</mo>
    <mo maxsize="2.470em" minsize="2.470em" stretchy="true" symmetric="true" form="prefix">‖</mo>
    <mo>…</mo>
    <mo maxsize="2.470em" minsize="2.470em" stretchy="true" symmetric="true" form="postfix">|</mo>
    <mo maxsize="2.047em" minsize="2.047em" stretchy="true" symmetric="true" form="postfix">|</mo>
    <mo maxsize="1.623em" minsize="1.623em" stretchy="true" symmetric="true" form="postfix">|</mo>
    <mo maxsize="1.2em" minsize="1.2em" stretchy="true" symmetric="true" form="postfix">|</mo>
    <mo stretchy="false" form="postfix">|</mo>
</math>

(whether it's postfix or prefix doesn't seem to matter)

Though the spacing of the double lines is now a bit too tight, actually. But I don't know how to fix that.

Note

This means I don't have to use the <mi> trick anymore, for symmetric fences. I just have to set them to form="prefix".

tmke8 commented 1 week ago

I still need to <mi> trick for / (and probably others), because <mo form="prefix">/</mo> still has the wrong spacing.

Though I suppose I could use custom spacing: <mo lspace="0" rspace="0">/</mo>.

tmke8 commented 1 week ago

For \Vert and \lVert I would use form="prefix", but for \rVert it would be nice to use form="postfix" (even though I'm not sure this makes any difference.