Converts simple LaTeX to an unicode approximation
Project description
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, there are no subscript characters for uppercase latin characters, and all subscript or superscript characters are in roman font (upright).
Some code is rendered the best best approximation, for example, p_T as 𝑝ₜ, assuming that a reasonable approximation is preferred over a failed conversion.
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.
Examples
LaTeX |
Unicode |
---|---|
\alpha \beta \gamma \Gamma |
𝛼 𝛽 𝛾 𝛤 |
e^+ \mu^- |
𝑒⁺ 𝜇⁻ |
\exists \in \int \sum \partial \infty |
∃ ∈ ∫ ∑ ∂ ∞ |
\slash{\partial} |
∂̸ |
\to \longrightarrow |
→ ⟶ |
p\bar{p} \mathrm{t}\bar{\mathrm{t}} |
𝑝𝑝̄ tt̄ |
\mathcal{H} \mathbb{R} |
ℋ ℝ |
\phone \checkmark |
☎ ✓ |
\underline{x} \dot{x} \ddot{x} \vec{x} |
𝑥̲ 𝑥̇ 𝑥̈ 𝑥⃗ |
A^6 m_0 |
𝐴⁶ 𝑚₀ |
1.2 \times 10^{23} |
1.2 × 10²³ |
\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 \cdot \mathbf{x} \simeq \mathbf{b} |
𝐴⋅𝐱≃𝐛 |
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
Built Distribution
File details
Details for the file unicodeitplus-0.2.0.tar.gz
.
File metadata
- Download URL: unicodeitplus-0.2.0.tar.gz
- Upload date:
- Size: 90.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8eea19ccc6ad593cc02131f50b7a09039f67f5577639f352873c96f9cc17b0db |
|
MD5 | a3f73d271597883812d48ed358809342 |
|
BLAKE2b-256 | 8a362226049ed1a5ba3774cd63e33e2b21fe0bbaba19f3a75619d46ad724f2ee |
File details
Details for the file unicodeitplus-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: unicodeitplus-0.2.0-py3-none-any.whl
- Upload date:
- Size: 25.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | caedb1218f1ed2e041ed9fdac9b59b78b7bb1d0b6c7e319f0e131342ac699fa5 |
|
MD5 | 9e9bb1a1f68e92f03f3843bf682f93d0 |
|
BLAKE2b-256 | dba5e14cbe9681e045b6ca069d91676981eeab06587d6697b5f6b56fee912b13 |