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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for flatlatex-0.7.tar.gz
Algorithm Hash digest
SHA256 7bf59d44ad8fff084b2a9abe75092ba2574255770c93e92b71a106bc423b60e2
MD5 99dbe300ee8675ea8406cfc9c109d8b8
BLAKE2b-256 8ac0c2ab1355fc822403e4ed59d69e2ce2983a7a78effe6328b779a8a0cb3c86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flatlatex-0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 edd4c7d9f19e56acc7d2751020cb593702e50a54e3f0fb3b7d78a4199bb1be9f
MD5 47acfd1abe7dc8e32bcc45091cb041aa
BLAKE2b-256 b48651b251bec8e184511fa24862111b2e27412603c7b0abc3c5af6f08f4760d

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