jgm/texmath

MathML <mo> created for each adjacent Rel symbol

LynnKirby opened this issue · 5 comments

According to the TeXBook, adjacent Rel symbols shouldn't have space between them. In the MathML output, multiple <mo> are created for each symbol which doesn't seem correct. Example of current behaviour:

Input: :::

MathML output:

<mo>:</mo>
<mo>:</mo>
<mo>:</mo>

I would expect only one element to be output. This is what MathJax does, for example.

Actually, spacing attributes are probably more correct than collapsing the symbols into one element. E.g.

<mo rspace=0>:</mo>
<mo rspace=0>:</mo>
<mo>:</mo>
jgm commented

I'm curious, why is the latter better?

An <mo> element is semantically a single operator. It's only correct to collapse adjacent symbols into a single element when the intention is given (like using \mathop{}).

jgm commented

Can you give page reference to the relevant part of the TeX book?

The table at chapter 18, page 170 gives the amount of inter-element spacing. Following the rules in appendix G, adjacent Rel aren't otherwise transformed so the (lack of) spacing applies directly.