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

Uploaded Source

Built Distribution

flatlatex-0.8-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for flatlatex-0.8.tar.gz
Algorithm Hash digest
SHA256 bc767a4cff81f8277545e90e3367899368c9fd91b8b132ec439c1c79ec33ac53
MD5 6f2b33304afc99c94155b387ce9fef1a
BLAKE2b-256 963bc8a4d978917b566cda9bef701294b9bb65dd19a7a027829eeb66fe21ef90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flatlatex-0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 014f2e885c3fb2517b0cbb5cf3c73e1dfc9e47487490a2f8d28e30bf0b94f71f
MD5 0caec003a6b4cf68ab3d3fb19a74980d
BLAKE2b-256 0d48ebc153bbfc4674d3d4a33e31ea31f84d07770ae7a1a49ec43688e7d863ce

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