jgm/texmath

Ignored \mathrm when converting from .tex to .odt

Zmuogs opened this issue · 3 comments

During conversion from .tex to .odt operator \mathrm is ignored.
F.e.: when a.tex.zip converted to a.odt.zip with pandoc -f latex -t odt -o a.odt a.tex I get italic "E" which should be roman:
Auto Generated Inline Image 1
Using Linux (Kubuntu 19.10) and pandoc -v:

pandoc 2.8.0.1
Compiled with pandoc-types 1.20, texmath 0.12, skylighting 0.8.3

and LibreOofice

Version: 6.3.3.2
Build ID: 1:6.3.3-0ubuntu0.19.10.1
CPU threads: 16; OS: Linux 5.3; UI render: default; VCL: kde5;
Locale: lt-LT (lt_LT.UTF-8); UI-Language: en-US
Calc: threaded
jgm commented

It's not clear to me yet that this is a bug in texmath. For the \mathrm{E} texmath generates this mathml:

    <mstyle mathvariant="normal"><mi>E</mi></mstyle>

We need to determine whether there is a better option for conversion. It could be that LibreOffice is simply misrendering this. Note that <mi> means "identifier", not "italics". Note also that the mathvariant attribute has among its options normal and italic; by selecting normal, one would think we are selecting upright text. There is no other option value for upright text.

I suspect that LibreOffice is rendering this incorrectly, and that the bug is in LibreOffice.

Safari's MathML renderer renders the E upright, with the same MathML pandoc is producing for use in the ODT.

yunmc commented

It's not clear to me yet that this is a bug in texmath. For the \mathrm{E} texmath generates this mathml:

    <mstyle mathvariant="normal"><mi>E</mi></mstyle>

We need to determine whether there is a better option for conversion. It could be that LibreOffice is simply misrendering this. Note that <mi> means "identifier", not "italics". Note also that the mathvariant attribute has among its options normal and italic; by selecting normal, one would think we are selecting upright text. There is no other option value for upright text.

I suspect that LibreOffice is rendering this incorrectly, and that the bug is in LibreOffice.

Safari's MathML renderer renders the E upright, with the same MathML pandoc is producing for use in the ODT.

hi, how to fix it? I have same problem when I try convert mathml to latex, thanks!

jgm commented

I think #206 will fix this. In any case this is the same issue as #205 so I'll close it.