Parse LaTeX math expressions
Python ANTLR
Switch branches/tags
Nothing to show
Clone or download
Latest commit fe533f2 Oct 6, 2016
Failed to load latest commit information.
gen Initial commit Jan 10, 2016
.gitignore Add ratios Sep 22, 2016
LICENSE.txt Added MIT license to repo. Mar 13, 2016
PS.g4 Add \mathit Sep 23, 2016 Update README Oct 5, 2016 Initial commit Jan 10, 2016 Start AsciiMath printer Aug 23, 2016 Don't evaluate absolute value Sep 24, 2016 Test bad strings Sep 24, 2016


latex2sympy parses LaTeX math expressions and converts it into the equivalent SymPy form.


ANTLR is used to generate the parser:

$ antlr4 PS.g4 -o gen


In Python 2.7:

from process_latex import process_sympy

process_sympy("\\frac{d}{dx} x^{2}")
# => "diff(x**(2), x)"


LaTeX Image Generated SymPy
x^{3} x**3
`\frac{d}{dx} t x`
\sum_{i = 1}^{n} i Sum(i, (i, 1, n))
\int_{a}^{b} \frac{dt}{t} Integral(1/t, (t, a, b))
`(2x^3 - x + z) _{x=3}`


Contributors are welcome! Feel free to open a pull request or an issue.