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.4.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

flatlatex-0.4-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for flatlatex-0.4.tar.gz
Algorithm Hash digest
SHA256 bc1ceb61e4858ec999c848c00b7b53df6a5b71fff844977a30a6c5ae9aab3e1b
MD5 42b2004eaab724dc61f42615dff3fd82
BLAKE2b-256 a49dc08648fcedb25d50df95637db150c9c38b884ad91bcf9a07b50f2404e9b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flatlatex-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4c7d938ad6eaf45bc20fdd4dc5bdc247b4a468aaf90a2e9c08689f3e0094efa8
MD5 07e4bf58c83dd5c67e92ef4f859221a4
BLAKE2b-256 6842e2b1ab54dc23138d1bd8dd827fc9edcbd1f06a23d0bd7bd10f73d9c12ffc

See more details on using hashes here.

Supported by

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