-
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
\mhchem conversion: MathML to OOML/MathML equation leads to additional width in equation #197
Comments
Wow, this is quite elaborate MathML for something so simple! Why not <math display="block" xmlns="http://www.w3.org/1998/Math/MathML">
<mstyle mathvariant="normal">
<msub>
<mi>H</mi>
<mn>2</mn>
</msub>
<mi>O</mi>
</mstyle>
</math> Our MathML reader does not yet implement The other is the treatment of PS. Have you tried my my mhchem Lua filter? That may be a simpler approach. |
Yes, I had a look, but this would add support for one package, whereas if we could support generic MathML we'd reach more use cases (and would have 100% compatibility between what users see as an SVG in the editor and what is exported with their paper - at least in theory). MathML is a supported format for a number of discipline specific editor. It might also allow us to take complex TeX that uses a lot of packages and condense it to a publication format that can be used in PD, EPUB, or websites. Back then I followed an issue on mhchem and for some reason concluded that support would also only be partial. I will take another look. The complex MathML is unfortunately the way that MathJax 3 produces it. But yours of course is a lot nicer. How do you feel about adding support for |
but rather to
Currently we handle mpadded by ignoring it and just processing what's inside. We could add a special case that checks to see if we have a width of 0 specified, in which case we could ignore the contents and insert a zero-width space, or nothing. That wouldn't be general support for mpadded, but it would handle this specific case. |
The font issue is related to #149. MathML has no way to specify "upright" or "roman" font; it just has an option for "no special font adjustment." Maybe we should always use roman style for |
Hello,
I am currently trying to export \mhchem equations to DocX using Pandoc. Since \mhchem is not supported natively, I transformed the TeX to MathML and then tried to convert the MathML to OOML for Word.
Using https://johnmacfarlane.net/texmath.html I could see that even in the MathML to MathML conversion the zero-width mpadded element is dropped. This would explain the additional horizontal space in the screenshot.
Looking at the OOML that Word produces directly (I am attaching the DocX file) I can see that Word added a <m:zeroWid m:val="1"/> element whereas in the the <m:phant> element in the OOML produced by TeXMath does not have a zero-width thus pushing the 2 down correctly but introducing white space.
Source Equation:
Resulting MathML (using MathJax):
DocX file as produced by Word:
HA2O.docx
I think that using MathML directly could open up a whole other world of equations for researchers, since we would not depend on all packages being available through Pandoc directly. I'd be happy to help and to provide further examples - unfortunately, I do not understand the code base enough to provide a fix or analysis.
Kindly
Frederik
The text was updated successfully, but these errors were encountered: