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

Support for equations #17

Open
sunu opened this issue Jun 14, 2016 · 10 comments
Open

Support for equations #17

sunu opened this issue Jun 14, 2016 · 10 comments

Comments

@sunu
Copy link

sunu commented Jun 14, 2016

Currently it ignores equations with the following warning
An unrecognised element was ignored: {http://schemas.openxmlformats.org/officeDocument/2006/math}oMath

Is it possible to add support for equations?

Thanks for all your work. :)

@mwilliamson
Copy link
Owner

I haven't really looked into adding support for equations. I suspect, however, that it would be quite a lot of work, and take more time than I currently have spare, unless there happens to be another library that already handles this.

Would you mind providing a small example document that I can take a look at in case I find the time?

@sunu
Copy link
Author

sunu commented Jun 15, 2016

Sure. I'm attaching a file which only has a equation in it. I'm hoping that will make things easier to handle. If you need a bigger file to look at let me know.
equation.docx

The problem, as far I understand, is that there is no native way to present OMML in HTML. We have to convert it to either MathML or LaTeX and then use some kind of external JavaScript library like Mathjax to properly render it in the browser.

There are some libraries like https://github.com/xiilei/dwml to help with the conversion.

Another alternative way of representing equation would be to convert them into images. But I'm not very sure how that can be done.

Let me know what you think. I can also help getting a PR ready for this if we can make a concrete plan for the implementation.

Thanks again :)

@GitBruno
Copy link
Contributor

GitBruno commented Oct 25, 2016

Images are no good in my opinion, as it looses semantics. MathML seems to be the best fit for HTML. Maybe look at https://github.com/jgm/texmath to do the heavy lifting? This library can go from OMML (Office Math Markup Language, used in Microsoft Office) to MathML.

@sulazix
Copy link

sulazix commented Feb 17, 2018

Hello,
I can confirm that image conversion is not an ideal solution (for accessibility issue). MathML is currently the recommanded by the W3C and WAI for equation markup in HTML.
I also know that a lot of people are using MathType for equation typing in Word, a compatility with this soft can be realy great :-)
As anyone progressed in any implementation of this feature ?

@vikasvisking
Copy link

Any progess for this feature...?

@GitBruno
Copy link
Contributor

GitBruno commented Mar 4, 2019

Just found out about KaTeX might be a good alternative to MathML

@ildarakhmetov
Copy link

A really important feature, would love to see it in python-mammoth.

@zlqm
Copy link

zlqm commented Apr 21, 2020

There is a trick to convert equation inside a docx file into LaTeX.

As equation is stored as omath tag inside word/document.xml, we can extract it out and transform it into LaTeX format, then put it back as normal text.

Here is a demo

@RuiLiu0129
Copy link

There is a trick to convert equation inside a docx file into LaTeX.

As equation is stored as omath tag inside word/document.xml, we can extract it out and transform it into LaTeX format, then put it back as normal text.

Here is a demo

Very helpful! Thanks a lot!

@Flore-Acher
Copy link

Hi @mwilliamson There are any news or suggestions to support Math and Chemistry Formulas? How could we collaborate with this issue to achieve it?

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

No branches or pull requests

9 participants