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\,'
...     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}')
'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.11.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

flatlatex-0.11-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flatlatex-0.11.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.1+

File hashes

Hashes for flatlatex-0.11.tar.gz
Algorithm Hash digest
SHA256 d3148ca49de7df943803f6aa5624aee255456ea04b9cc24f17e0cb43a5738d02
MD5 4e9f9107c498ae731275f5f663126a49
BLAKE2b-256 2efde079dda9806859da55fe90978070de875fa36db9ad91c70d7a4419239f52

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flatlatex-0.11-py3-none-any.whl
  • Upload date:
  • Size: 22.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.1+

File hashes

Hashes for flatlatex-0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 f31523da6d82806ed797ad3db232bd318811339b0c13050583fec7a381067d0d
MD5 2eee6d60e82d44be49235552ce17a227
BLAKE2b-256 23e76e90e09cd555e41e5362352557a485673f36612a5792718edc8b74190c27

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