mathlive icon indicating copy to clipboard operation
mathlive copied to clipboard

MathML wrong for expression with |

Open NSoiffer opened this issue 6 years ago • 0 comments

Description

The MathML for {x^2}+2x|_{x=3} is wrong:

<mrow><msup><mi extid="e842v2">x</mi><mn extid="e842v3">2</mn></msup><mo extid="e842v4">+</mo><mn extid="e842v5">2</mn><mo>&InvisibleTimes;</mo>
<mi extid="e842v6">x</mi>
<mo>&InvisibleTimes;</mo>
<msub><mo extid="e842v7">∣</mo><mrow><mi extid="e842v8">x</mi><mo extid="e842v9">=</mo><mn extid="e842va">3</mn></mrow></msub></mrow>

The &InvisibleTimes; before the subscripted | is wrong. It should get added between operands. For sub/superscripts, you should look usually look at the base and see if it is an operand or operator. In this case, | is an operator, so should not add the &InvisibleTimes;.

In various cases, when operators are prefix or postfix, they can act as an operand, but in this case, | acts like a postfix operator and should not be treated as an operand. E.g, in 3!*-4, ! is a postfix operator so that the subexpression to the left of the * is an operand. Similarly, the - (in this case) is a prefix operator, so the subexpression to the right of the * is an operand. Of course, the * is explicit multiplication, so &InvisibleTimes; doesn't need to be added. However, it would be added in an expression like 3!(-4).

NSoiffer avatar Feb 19 '19 02:02 NSoiffer