Skip to content
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

Export MathML in ODT as LaTeX #5602

Open
memeplex opened this issue Jun 20, 2019 · 8 comments · Fixed by #5606
Open

Export MathML in ODT as LaTeX #5602

memeplex opened this issue Jun 20, 2019 · 8 comments · Fixed by #5606

Comments

@memeplex
Copy link

I have created the attached and zipped odt by exporting it from google docs. The text is just "Hi x^2" where x^2 is an squared x as an equation. Converting it to markdown using pandoc gives:

pandoc -t markdown Prueba.odt 
Hi ![](./ObjectReplacements/Object 2){width="0.1417in"

Inside the odt Object 2/content.xml is:

cat Object\ 2/content.xml 
<?xml version="1.0" encoding="UTF-8"?>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><msup><mi>x</mi><mn>2</mn></msup><annotation encoding="StarMath 5.0">{x} ^ {2}</annotation></semantics></math>

that is, the equation was exported as MathML, not as an image. Now, I would have expected this to be exported as LaTeX in the markdown output.

Am I missing something?

Pandoc version: 2.2.1

Prueba.zip

@memeplex
Copy link
Author

BTW, this is the output when exporting as docx:

pandoc -t markdown Prueba.docx 
Hi $x^{2}$.

Much better!

@jgm
Copy link
Owner

jgm commented Jun 21, 2019

I don't think the Odt reader currently parses math elements.
This would be a very useful addition, and it shouldn't be hard -- we already convert mathml to tex in reading docbook, for example.

Note, however, that we'd only be able to parse presentation mathml, not semantic mathml (you use the 'semantics' tag here).

@memeplex
Copy link
Author

I barely understand mathml, let alone what semantic/presentation tags are. I can say that it works fine with docx though, so if you're doing the "presentation" stuff there I assume it should work here too.

@memeplex
Copy link
Author

memeplex commented Jun 21, 2019

Maybe I should have mentioned that equations are represented as mathml in docx too. I have verified this. I don't know about the semantic/presentation thing though.

@mb21
Copy link
Collaborator

mb21 commented Jun 21, 2019

Might work with #5606...

@jgm
Copy link
Owner

jgm commented Jun 25, 2019

@memeplex No, docx doesn't use mathml. It uses a different, XML-based math format. texmath and pandoc can convert between these.

@jgm jgm closed this as completed in #5606 Jul 13, 2019
@memeplex
Copy link
Author

Thanks!

@jgm jgm reopened this Jul 13, 2019
@jgm
Copy link
Owner

jgm commented Jul 13, 2019

Sorry, it was claimed in the PR that it fixed this issue, but it doesn't.
@BImage was your PR supposed to handle this "object replacement" stuff?
The other issue is math parsing; I don't believe we currently parse mathml in the odt reader, though we could.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants