skillfed

latex2sympy2-extended

Convert LaTeX math to SymPy expressions

latex2sympy2-extended v1.11.0 3.4M downloads/30d#2,628 on PyPI
Permissive license MIT AGING released

What it is and what it does

latex2sympy2_extended is a LaTeX-to-SymPy parser that reads mathematical notation in LaTeX format and produces equivalent SymPy symbolic expressions. It uses ANTLR 4.13.1 to generate its parser and handles a broad range of mathematical constructs: basic arithmetic and functions, calculus operations like derivatives and integrals, linear algebra including matrices and determinants, and set operations. The package is adapted from an earlier latex2sympy project and supports multiple ANTLR runtime versions.

The typical workflow is to pass a LaTeX string to the main `latex2sympy()` function, which returns a SymPy expression you can then manipulate, evaluate, or further process in Python. It handles subscripts, Greek letters, common mathematical functions, and complex expressions with nested operations. One important caveat: operations on determinants, transposed matrices, and elementary row/column transformations perform actual symbolic computation and are not reversible—the result is simplified rather than left as a structural representation.

Use it for:

  • Convert handwritten or scanned LaTeX math formulas into SymPy for symbolic computation and manipulation.
  • Parse mathematical expressions from documents or user input to enable programmatic solving and evaluation.
  • Automate derivation and integration workflows by converting LaTeX calculus notation to SymPy Derivative and Integral objects.
  • Transform matrix notation from LaTeX into SymPy Matrix objects for linear algebra operations.
  • Build educational tools or math tutoring systems that accept LaTeX input and perform symbolic analysis.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Parses LaTeX math expressions and converts them to SymPy symbolic form, supporting arithmetic, functions, calculus, linear algebra, and set operations.

Yes, if you need to parse LaTeX math into SymPy. The package has low install friction, permissive licensing, no known vulnerabilities, and solid popularity (top 5000). The aging maintenance status (216 days since last release) is a minor concern for a parser—grammar-based tools are relatively stable—but verify that the ANTLR runtime version you choose aligns with your environment. Suitable for production use in math-heavy applications.

Install

latex2sympy2-extended on PyPI

pip

pip install latex2sympy2-extended

uv

uv add latex2sympy2-extended

poetry

poetry add latex2sympy2-extended

Installing latex2sympy2-extended

Before you install

Low install friction with only two runtime dependencies (sympy and antlr4-python3-runtime). Package is aging—last release was 216 days ago—so expect slower response to issues, though no active maintenance problems are evident.

License in practice

MIT license is permissive, allowing use in commercial and proprietary projects with minimal restrictions.

Quickstart

pip install latex2sympy2-extended

from latex2sympy2_extended import latex2sympy

tex = r"\frac{d}{dx}(x^{2}+x)"
result = latex2sympy(tex)
# => "Derivative(x**2 + x, x)"

Requires Python 3.10 or later.

Verify before relying

  • Whether determinant, transpose, and elementary transformation calculations are truly irreversible in all use cases or only under specific conditions.
  • Performance characteristics with large or deeply nested LaTeX expressions.
  • Completeness of support for less common LaTeX math environments beyond those documented in examples.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 2 — sympy, antlr4-python3-runtime
Maintenance aging — 216 days since the last release
First released
Downloads 3,417,128/month — #2,628 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: latex2sympy2_extended-1.11.0-py3-none-any.whl

Tags

latex to sympy conversionparse latex math expressionslatex equation parserconvert latex to pythonsymbolic math from latexlatex derivative integrationmatrix latex parser
latex-parsingsymbolic-mathmath-conversion

More Mathematics packages