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

How can I convert latex to Word format #2392

Closed
xu756 opened this issue Oct 24, 2023 · 6 comments
Closed

How can I convert latex to Word format #2392

xu756 opened this issue Oct 24, 2023 · 6 comments

Comments

@xu756
Copy link

xu756 commented Oct 24, 2023

Great library。

like this

new MathRun('c = \\pm\\sqrt{a^2 + b^2}')

I want

image How can I do it?
@mwashambw
Copy link

I have spent more than 10 hours finding solution for this. I have not found the answer untill now

@dolanmiu
Copy link
Owner

dolanmiu commented Nov 5, 2023

Read the documentation here, it should give you a good idea:

https://docx.js.org/#/usage/math?id=math

@dolanmiu dolanmiu closed this as completed Nov 5, 2023
@mwashambw
Copy link

Already I have read it. What I have understood from this documentation is math object useful if you know the math equations and you want to write it manually. What if I want to use the code to write different equations to the document that I don't know how they are?
In my case i have different math equations in data base saved in latex format, I want to write them to the word document programmatically. How can I use math object to implement this, while I don't know if the equation will have radical or square e.t.c
I have tried different approach, I tried to convert those latex equations into MathML and paste into word document manually I have found that equations are rendered correctly ,But I have not found the way to pass MathML to the document via docx library

@dolanmiu
Copy link
Owner

dolanmiu commented Nov 8, 2023

Not in scope I am afraid, it would require creating a Latex tokeniser and parser, and then a way to convert that MathML AST into json.
It would be possible, if there is an NPM package which turns MathML into JSON, but out of scope of this project.

@mwashambw
Copy link

Thanks for your response. So what is work round for this? Should I convert those equations into images and then imbed the to the document?

@dolanmiu
Copy link
Owner

dolanmiu commented Nov 8, 2023

That can be a workaround yes. Would be cool if you could release this work around as an npm package too!

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

No branches or pull requests

3 participants