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

Uploaded Source

Built Distribution

flatlatex-0.2-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for flatlatex-0.2.tar.gz
Algorithm Hash digest
SHA256 4a0c638a0a76241ffabe13fafbeb97c1a52e9080c4319e25cee7d1e6bc22e804
MD5 072f7d323282b1376f2c76f0f3d31c6c
BLAKE2b-256 bf7a3535a242055d607f9281e7e1234cdb312dd6813b3cd3757bd0940615c6d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flatlatex-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e1b20600c418788b763632932df777ba785442861226cd213de2b67405244862
MD5 43e993a465c9a0d1022956df99ad1504
BLAKE2b-256 6a2c79319122b5670d007906d77cc28f08391543615f8638e831b6b4e1d7ced8

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