Closed opoudjis closed 3 years ago
@opoudjis could you give the changes in 49ccf25 a try? This should cause accent="true"
and accentunder="true"
to get produced on munder
, mover
, and munderover
tags for every symbol that's marked as :accent
.
Interestingly enough asciimath.js doesn't seem to produce these attributes either. According to MDN only Firefox actually does anything with them. It doesn't cause any problems when adding them though, so no there's no harm in this change.
Thank you. It turns out that the Word OOXML stylesheets make a further assumption, that the second argument of mover is an mo, in order to apply the accent conversion:
<xsl:when test="$fAccent = 1 and $ndCur/child::*[2] = mml:mo">
So AsciiMath generates: <mover accent="true"><mrow><mi>p</mi></mrow><mrow><mo>^</mo></mrow></mover>
Word expects: <mover accent="true"><mrow><mi>p</mi></mrow><mo>^</mo></mover>
I have already inserted preprocessing to remove the mrow from the second child of an element with accent=true; once I do this, your fix works fine. I am not requesting you to do that preprocessing for Word; I have what I need. Thank you!
🙄 I'm still surprised how picky Word is about MathML. They claim to support it but half the valid MathML out there probably doesn't render right...
Word's Maths remains a dumpster fire if you look at it closely enough. :-( The latest I've had to deal with is that it completely ignores its own font shift commands; I've had to inject HTML markup to force them to work...
I went ahead and added some code to avoid mrow
on the accent sub/under and sup/over elements if possible. That logic is Word specific anyway, might as well give it what it wants.
You, Pepijn, are a good human being, and it is always a pleasure working with you.
☺️ My little contribution to counterbalance all the awfulness of 2020.
@pepijnve We can close this issue right?
I'm looking to you for the answer there @opoudjis. If the fix is sufficient for you then this can be closed indeed.
It is, thank you. Closing!
hat p
currently renders into MathML as<mover><mi>p</mi><mo>^</mo></mover>
. When this is converted into Word, the result isinstead of the desired
Inspecting the Word OOXML XSLT, it turns out that Word expects to see
<mover accent="true"><mi>p</mi><mo>^</mo></mover>
, in order to render the equation with the its<m:acc>
tag. The hat operator of Asciimath is recognised as being of class:accent
, but that class is not being propagated into the Asciimath parse.