Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

A LaTeX math converter to unicode text

Project description

flatlatex is a basic converter from LaTeX math to human readable text math using unicode characters.

Basic example:

>>> import flatlatex
>>> c = flatlatex.converter()
>>> c.convert(
... (
...     r'\forall \eta>0\, \exists n\in\mathbb{N}\, \forall i>n\,'
...     r' |u_i-\mathcal{l}|<\eta'
... ))
'∀η>0 ∃n∈ℕ ∀i>n |uᵢ-𝓵|<η'

Commands can be added with LaTeX syntax:

>>> import flatlatex
>>> c = flatlatex.converter()
>>> c.add_newcommand(r'\newcommand\prob{\mathbb{P}}')
>>> c.add_newcommand(r'\newcommand\binom[2]{\frac{#2!}{#1!(#2-#1)!}}')
>>> c.convert(r'\prob(X=k)\,=\,\binom{k}{n}\times p^k(1-p)^{n-k}')
'ℙ(X=k) = (n!)/(k!(n-k)!)×pᵏ(1-p)ⁿ⁻ᵏ'

The behavior can be change:

>>> import flatlatex
>>> c = flatlatex.converter()
>>> c.convert(r'\frac{8}{9}')
>>> c.allow_zw = False
>>> c.convert(r'\frac{8}{9}')

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
flatlatex-0.8-py3-none-any.whl (23.2 kB) Copy SHA256 hash SHA256 Wheel py3
flatlatex-0.8.tar.gz (13.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page