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

Uploaded Source

Built Distribution

flatlatex-0.13-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flatlatex-0.13.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

File hashes

Hashes for flatlatex-0.13.tar.gz
Algorithm Hash digest
SHA256 7633915556e9d953db67a6f17281cf176d283037413aa179c7592d3eb01bdf5d
MD5 289bfb3f876c816f4ccf9376284421f2
BLAKE2b-256 25681d285e7da4317b9c7f447cd7e7ad9029c4f0852a32b16512a8fe2d21bd32

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flatlatex-0.13-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

File hashes

Hashes for flatlatex-0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 2212a693740de459eb22cb1f4f8dd67577455910f825417d5ca93ba585348ded
MD5 d9326e022a107fadb59c953027c2bef4
BLAKE2b-256 1cdd7627667510aab64a42d4d4949a165c23062ccb2ebbfedd6123f631665806

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