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
Release history Release notifications | RSS feed
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.14.tar.gz
(15.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
flatlatex-0.14-py3-none-any.whl
(23.3 kB
view details)
File details
Details for the file flatlatex-0.14.tar.gz.
File metadata
- Download URL: flatlatex-0.14.tar.gz
- Upload date:
- Size: 15.4 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
201439355843801e620411d2f50b0af3fe3d2c1b8c7c2a9d68374fe2b164b269
|
|
| MD5 |
e61b3ccbbe2cd3eb8212cb535a99a94a
|
|
| BLAKE2b-256 |
0c41a49239282fe00998463521a1e7dcc2e677874b6b58522422cbda099941b1
|
File details
Details for the file flatlatex-0.14-py3-none-any.whl.
File metadata
- Download URL: flatlatex-0.14-py3-none-any.whl
- Upload date:
- Size: 23.3 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bff857224fcf0e2297463563af1161f6b59109b6b2d5e0c77fd4c820f9b7e823
|
|
| MD5 |
410e4507aef6a64aeff6d100d11a7b9d
|
|
| BLAKE2b-256 |
56ef742ac39294da244d46008f4b13be9b4bf4ae5a8cda186fc27460816847f1
|