augustt198 / latex2sympy

Parse LaTeX math expressions
MIT License
388 stars 163 forks source link

Reverse SymPy LaTeX printer #11

Open Upabjojr opened 8 years ago

Upabjojr commented 8 years ago

SymPy has a LaTeX printer, the function latex( ) returns the LaTeX representation of the string.

It would be good to add tests, to check that latex2sympy is able to parse back generated LaTeX strings to SymPy's original expression.

Given a SymPy expression, let's say expr, test could look like:

from sympy import latex
assert eval(process_latex(latex(expr))) == expr

This could be used to both: