LaTeX math to Unicode text converter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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'
Raw data
{
"_id": null,
"home_page": "https://github.com/jb-leger/flatlatex",
"name": "flatlatex",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": "",
"keywords": "latex math unicode",
"author": "Jean-Benoist Leger",
"author_email": "jb@leger.tf",
"download_url": "https://files.pythonhosted.org/packages/33/7e/31f7ea4843fa7ed12c46a4e96e2d425b873f4bdb90463e32a0c9f163a3ec/flatlatex-0.15.tar.gz",
"platform": "",
"description": "\nLaTeX math to Unicode text converter\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nflatlatex is a basic converter from LaTeX math to human readable text math\nusing unicode characters.\n\nBasic example:\n\n >>> import flatlatex\n >>> c = flatlatex.converter()\n >>> c.convert(\n ... (\n ... r'\\forall \\eta>0\\, \\exists n\\in\\mathbb{N}\\, \\forall i>n\\,'\n ... r' |u_i-\\mathcal{l}|<\\eta'\n ... ))\n '\u2200\u03b7>0 \u2203n\u2208\u2115 \u2200i>n |u\u1d62-\ud835\udcf5|<\u03b7'\n\nCommands can be added with LaTeX syntax:\n\n >>> import flatlatex\n >>> c = flatlatex.converter()\n >>> c.add_newcommand(r'\\newcommand\\prob{\\mathbb{P}}')\n >>> c.add_newcommand(r'\\newcommand\\binom[2]{\\frac{#2!}{#1!(#2-#1)!}}')\n >>> c.convert(r'\\prob(X=k)\\,=\\,\\binom{k}{n}\\times p^k(1-p)^{n-k}')\n '\u2119(X=k) = (n!)/(k!(n-k)!)\u00d7p\u1d4f(1-p)\u207f\u207b\u1d4f'\n\nThe behavior can be change:\n\n >>> import flatlatex\n >>> c = flatlatex.converter()\n >>> c.convert(r'\\frac{8}{9}')\n '\u2078\u2044\u2089'\n >>> c.allow_zw = False\n >>> c.convert(r'\\frac{8}{9}')\n '8/9'\n\n\n",
"bugtrack_url": null,
"license": "BSD-2",
"summary": "A LaTeX math converter to unicode text",
"version": "0.15",
"project_urls": {
"Homepage": "https://github.com/jb-leger/flatlatex"
},
"split_keywords": [
"latex",
"math",
"unicode"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6c7225f517ff2536ad23349aad429126badc07324333de7b287bfe97dba2988f",
"md5": "070bdd7cc24c26851fd39dfa2c3c58aa",
"sha256": "4cf3ed9c1b837935fd79468ddbb25ac561325467a3a9dc050805b297eb0b25c6"
},
"downloads": -1,
"filename": "flatlatex-0.15-py3-none-any.whl",
"has_sig": true,
"md5_digest": "070bdd7cc24c26851fd39dfa2c3c58aa",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3",
"size": 23338,
"upload_time": "2021-11-30T23:02:57",
"upload_time_iso_8601": "2021-11-30T23:02:57.591567Z",
"url": "https://files.pythonhosted.org/packages/6c/72/25f517ff2536ad23349aad429126badc07324333de7b287bfe97dba2988f/flatlatex-0.15-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "337e31f7ea4843fa7ed12c46a4e96e2d425b873f4bdb90463e32a0c9f163a3ec",
"md5": "cd0765311c020bc512e5a319065451a4",
"sha256": "5170e1bcd4fccb52bdbdff300b14b68730483bc46f6a2a89f7ae2bb024e4d139"
},
"downloads": -1,
"filename": "flatlatex-0.15.tar.gz",
"has_sig": true,
"md5_digest": "cd0765311c020bc512e5a319065451a4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 15418,
"upload_time": "2021-11-30T23:02:59",
"upload_time_iso_8601": "2021-11-30T23:02:59.227264Z",
"url": "https://files.pythonhosted.org/packages/33/7e/31f7ea4843fa7ed12c46a4e96e2d425b873f4bdb90463e32a0c9f163a3ec/flatlatex-0.15.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-11-30 23:02:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jb-leger",
"github_project": "flatlatex",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "flatlatex"
}