jgm / jgm/texmath

\mhchem conversion: MathML to OOML/MathML equation leads to additional width in equation

Open
#197 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
406
Forks
86
Avg merge
1h 25m
Merged PRs (30d)
1

Description

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.

comparison

Looking at the OOML that Word produces directly (I am attaching the DocX file) I can see that Word added a element whereas in the the 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:

```
\ce{ H2O }
```

Resulting MathML (using MathJax):

```

```

DocX file as produced by Word:
[HA2O.docx](https://github.com/jgm/texmath/files/9446161/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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.