Skip to main content

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\, |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}')
'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.

Source Distribution

flatlatex-0.5.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

flatlatex-0.5-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file flatlatex-0.5.tar.gz.

File metadata

  • Download URL: flatlatex-0.5.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for flatlatex-0.5.tar.gz
Algorithm Hash digest
SHA256 3a58cc0f8a6c8b9266ebc85331121ba952fe787860b53b5af8c8fb572f0b1679
MD5 586c743c231eddb6c48cab8ace94481d
BLAKE2b-256 832d01da3dd69276067468ff89f2d2b10952ad67be7ea18d50113cbe9408dc78

See more details on using hashes here.

File details

Details for the file flatlatex-0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for flatlatex-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 235a7fa70e548de717564c20ce229a03d544c55d750df3dce5bfd408d1e7ba1e
MD5 57a43a3135c5e5b090177de1ccd60a8b
BLAKE2b-256 9dbdc4b3ca4ff6a6ba00c6186a5c4cd788ab43ee5386bbbb2ac5ba774655c593

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page