phfaist / pylatexenc

Simple LaTeX parser providing latex-to-unicode and unicode-to-latex conversion
https://pylatexenc.readthedocs.io
MIT License
283 stars 35 forks source link

{\ensuremath{xxx}} gets removed by LatexNodes2Text().latex_to_text(value) #68

Closed Loligplayer33 closed 2 years ago

Loligplayer33 commented 2 years ago

First of all thank you very much for this project. It saved me from a lot of hassle with all the special characters!

I have a small issue with the processing of {\ensuremath{xxx]}:

My input to LatesNodes2Text().latex_to_text() is f.e.

{{Neutral CGM as damped Ly{\ensuremath{\alpha}} absorbers at high redshift}}

What gets returned is:

Neutral CGM as damped Ly absorbers at high redshift

-> The whole ensuremath gets removed

I saw that this case was handled the other way around (encoding unicode) here:https://pylatexenc.readthedocs.io/en/latest/latexencode/

But was unable to resolve this problem.

phfaist commented 2 years ago

Thanks for spotting this! I added a declaration for \ensuremath{...} in latex2text, so your issue should be fixed with my latest commit. Feel free to re-open if problem persists.

Loligplayer33 commented 2 years ago

Works like a charm! Thank you