viktorstrate / algebra-latex

Parse and calculate latex formatted math
https://www.npmjs.com/package/algebra-latex
MIT License
28 stars 9 forks source link

Brackets are lost when parsing and formatting some expressions #15

Open timmckague opened 2 years ago

timmckague commented 2 years ago

First of all, thank you creating and open sourcing this library. Not sure if you're still maintaining/using this library but just in case...

I've noticed some issues when I try to parse some expressions with brackets. For example if I feed in the latex 5 - ( 3 + 1 ) and then convert the result to math, I get 5-3+1 instead of 5-(3+1) I would expect.

At first I thought this might be related to an issue in the formatter, but digging a little further into the problem I see that the expressions 5 - 3 + 1 and 5 - (3 + 1) unexpectedly produce the same AST.