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

Uploaded Source

Built Distribution

flatlatex-0.9-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flatlatex-0.9.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for flatlatex-0.9.tar.gz
Algorithm Hash digest
SHA256 459ae6823e9bc588dd538e937f04b17d5bb59f966e9b32c9b8e0a5f013869d09
MD5 c51d92b85f733a55e99d0d4fa3823583
BLAKE2b-256 7f886e9430bc275808764836fa3c0789c66d8cef52a448cead1112814c9eeec7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flatlatex-0.9-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for flatlatex-0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 686d0dc0c965d63bd620e020d31d55feddac77091272a670348d5f2568296399
MD5 cc0e0303d563c5550daa67fb4c436066
BLAKE2b-256 531116a32eee719170504fcf4fb1f1b78661a7273dff4423690e2ab3fbd37dd0

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