ppizarror / PyDetex

An application that transforms LaTeX code to plain text
https://pydetex.readthedocs.io/
MIT License
38 stars 5 forks source link

flatlatex workaround to keep spaces #23

Closed jb-leger closed 2 years ago

jb-leger commented 2 years ago

Hi,

I am the dev of flatlatex. I do not understand when exactly you use flatlatex (but I am happy to see my module is useful), but I found one thing which can be a misuse. In _utils_tex.py line 785 you replace spaces by a special substring, and you do the reverse after conversion line 790. I think this because you want to preserve spaces.

In fact, this is a very bad idea, because, for example in LaTeX, this \frac a2 is pefectly valid, and give normaly ᵃ⁄₂, and this works fine with flatlatex. But if you replace space, the parsing get you a incorrect solution.

I had the same problem, and sometime I want to keep space. Therefore I had some unpushed code for that, I commit the code and I pushed it and I added a option keep_space in flatlatex v0.14 (but I set the default to False to preserve backward compat) (I pushed the doc in docstring in v0.15).

ppizarror commented 2 years ago

Hello, thanks for your library! I've updated the module requirements. Greetings 😄