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

Uploaded Source

Built Distribution

flatlatex-0.3-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for flatlatex-0.3.tar.gz
Algorithm Hash digest
SHA256 792557b6723a672317afb1c19557fe8faf81e4a6c6b8174175825284f31556c0
MD5 5d45e064e4630b30613c8cb3b0c56199
BLAKE2b-256 a98a655ca17661be81da36dca163f254a854474f795861dd13527d8681172b8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flatlatex-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 31ca75109e234ace39f2a9d8e7cf9f4b4e54a6b2ef218521a6ea00c67e6e890f
MD5 00ff4445e71271586fe7d40a9e9d8eaa
BLAKE2b-256 f5eff9f55fa5fe2e5d5ac02a9b0d690c00dcb3e250559e1cf8bd9efd0703509f

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