Skip to main content

Converts simple LaTeX to an unicode approximation

Project description

https://img.shields.io/pypi/v/unicodeitplus.svg

Convert simple LaTeX into an unicode approximation and paste it anywhere.

This package provides a more complete LaTeX to Unicode converter than unicodeit. unicodeitplus uses a better parser (generated from EBNF with the fantastic Lark library) than unicodeit, which handles some code on which unicodeit fails, and allows one to parse a mix of text and math code, like $p_T$ / GeV $c^{-1}$.

LaTeX to Unicode: How does this even work?

Unicode contains many subscript and superscript characters. It also font variations of characters of both latin and greek characters, including italic, boldface, bold italic, and more. It contains a lot of special mathematical characters and diacritical marks, which we use to approximate LaTeX renderings using just unicode characters.

Like unicodeit, unicodeitplus is largely based on unimathsymbols.txt from Günter Milde, which is maps LaTeX macros to Unicode symbols.

Caveats

  • Only a subset of all LaTeX code can be converted to Unicode. Some Unicode characters simply don’t exist. For example, subscript characters exist only for a subset of all lowercase latin characters, and there are no subscript characters for uppercase latin characters.

  • Your font needs to contain glyphs for the Unicode characters, otherwise you will typically see a little box with the unicode character index.

  • The visually best results seem to be obtained with monospace fonts.

  • Some conversions are deliberate approximations, for example, $p_T$ is rendered as 𝑝ₜ.

Examples

LaTeX

Unicode

\alpha

𝛼

\beta

𝛽

\gamma

𝛾

\Gamma

𝛤

\infty

e^+

𝑒⁺

\mu^-

𝜇⁻

\exists

\in

\int

\sum

\partial

\slash{\partial}

∂̸

\longrightarrow

\to

p\bar{p}

𝑝𝑝̄

\mathrm{t}\bar{\mathrm{t}}

tt̄

\mathcal{H}

\mathbb{R}

\underline{x}

𝑥̲

\phone

\checkmark

\dot{x}

𝑥̇

\ddot{x}

𝑥̈

\vec{x}

𝑥⃗

A^6

𝐴⁶

m_0

𝑚₀

\Im

\Re

\hbar

\perp

\parallel

\therefore

\because

\subset

\supset

p_T / \mathrm{GeV} c^{-1}

𝑝ₜ/GeV𝑐⁻¹

K^0_S

𝐾⁰ₛ

D^{\ast\ast} \to hhee

𝐷**→ℎℎ𝑒𝑒

A \mathbf{x} \simeq \mathbf{b}

𝐴𝐱≃𝐛

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

unicodeitplus-0.1.0rc3.tar.gz (144.9 kB view details)

Uploaded Source

Built Distribution

unicodeitplus-0.1.0rc3-py3-none-any.whl (75.8 kB view details)

Uploaded Python 3

File details

Details for the file unicodeitplus-0.1.0rc3.tar.gz.

File metadata

  • Download URL: unicodeitplus-0.1.0rc3.tar.gz
  • Upload date:
  • Size: 144.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.16

File hashes

Hashes for unicodeitplus-0.1.0rc3.tar.gz
Algorithm Hash digest
SHA256 ab2a91c6c18a2d28d23ca2fa4246e4038abed4f6ae5ed01bb80d61368798a1be
MD5 0dcbca74c4c9075a58f1b770a816c626
BLAKE2b-256 42b57dfe2a04125b888af82919eb04e4978b8682e6e61a8011f86131b765f5c4

See more details on using hashes here.

File details

Details for the file unicodeitplus-0.1.0rc3-py3-none-any.whl.

File metadata

File hashes

Hashes for unicodeitplus-0.1.0rc3-py3-none-any.whl
Algorithm Hash digest
SHA256 d0c9a97363a72dcfcbb0284f62df4188d87485af203e70b834f7eb06abfc9fd8
MD5 88b6a9f767ea383bf52b82a8f95cb738
BLAKE2b-256 09425c6b8a40758719880b014f3426d448c18ec93d66ac0ebc9fa6e8803f926c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page