PaddiM8 / kalker

Scientific calculator with math syntax that supports user-defined variables and functions, complex numbers, and estimation of derivatives and integrals
https://kalker.xyz
MIT License
1.59k stars 70 forks source link

LaTeX syntax support #118

Closed not-matthias closed 1 year ago

not-matthias commented 1 year ago

I always write formulas for university assignments in LaTeX and I have to rewrite the expression every time or use WolframAlpha. This would make the parsing a lot more complicated, so I would understand it if this feature is out-of-scope.

But what are your thoughts?

EDIT: Some examples

(1 - 0.6879) \cdot 2
\frac{0.31 - 0.3}{\sqrt{ \frac{0.3 \cdot (1 - 0.3)}{500} }}
PaddiM8 commented 1 year ago

I can see this being very useful. I guess it would be possible to detect LaTeX syntax (since backslashes aren't used for anything else) and invoke some different parser for that. It would be quite a lot of work though and would add some complexity to the parsing, so it's probably out of scope. However, if someone creates a good (and small) crate for parsing LaTeX it might make sense. I'll reopen this if the situation changes, because it could be quite convenient. I have also considered making it possible to generate LaTeX from kalker syntax. Might look into that once I have some more time.