tex_to_unicode 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tex_to_unicode/converter.rb +71 -71
- data/lib/tex_to_unicode.rb +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3fe364a184364e8e45c9ca5bd2c68cabe453f793283cc38071c897b40351ef7a
|
|
4
|
+
data.tar.gz: 6e22bdffa2357e2d06f673ee326c0c2541f7967aed09a45c59e1e6a196b31108
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb9aafedc15f45a9fc13031edc3d52b467e76259375707c06a335c3b59ff7f15b8b7d36106cb92270a36546ab8dfd6ee1aa6ece1350a92f4fa6310547083b7c5
|
|
7
|
+
data.tar.gz: 9dd89a04e9585dd505eb12717a24930c97957e73b14e0883833117d7376283e0fcaca96ea9be76cd7363818184fbf866ccf38a07f80d0a3457393fba3896682a
|
|
@@ -3,115 +3,115 @@ module TexToUnicode
|
|
|
3
3
|
# Comprehensive mapping of TeX commands to Unicode characters
|
|
4
4
|
TEX_TO_UNICODE = {
|
|
5
5
|
# Greek letters (lowercase)
|
|
6
|
-
'\\alpha' =>
|
|
7
|
-
'\\epsilon' =>
|
|
8
|
-
'\\theta' =>
|
|
9
|
-
'\\lambda' =>
|
|
10
|
-
'\\pi' =>
|
|
11
|
-
'\\sigma' =>
|
|
12
|
-
'\\phi' =>
|
|
13
|
-
'\\omega' =>
|
|
6
|
+
'\\alpha' => "α", '\\beta' => "β", '\\gamma' => "γ", '\\delta' => "δ",
|
|
7
|
+
'\\epsilon' => "ε", '\\varepsilon' => "ϵ", '\\zeta' => "ζ", '\\eta' => "η",
|
|
8
|
+
'\\theta' => "θ", '\\vartheta' => "ϑ", '\\iota' => "ι", '\\kappa' => "κ",
|
|
9
|
+
'\\lambda' => "λ", '\\mu' => "μ", '\\nu' => "ν", '\\xi' => "ξ",
|
|
10
|
+
'\\pi' => "π", '\\varpi' => "ϖ", '\\rho' => "ρ", '\\varrho' => "ϱ",
|
|
11
|
+
'\\sigma' => "σ", '\\varsigma' => "ς", '\\tau' => "τ", '\\upsilon' => "υ",
|
|
12
|
+
'\\phi' => "φ", '\\varphi' => "ϕ", '\\chi' => "χ", '\\psi' => "ψ",
|
|
13
|
+
'\\omega' => "ω",
|
|
14
14
|
|
|
15
15
|
# Greek letters (uppercase)
|
|
16
|
-
'\\Gamma' =>
|
|
17
|
-
'\\Xi' =>
|
|
18
|
-
'\\Phi' =>
|
|
16
|
+
'\\Gamma' => "Γ", '\\Delta' => "Δ", '\\Theta' => "Θ", '\\Lambda' => "Λ",
|
|
17
|
+
'\\Xi' => "Ξ", '\\Pi' => "Π", '\\Sigma' => "Σ", '\\Upsilon' => "Υ",
|
|
18
|
+
'\\Phi' => "Φ", '\\Psi' => "Ψ", '\\Omega' => "Ω",
|
|
19
19
|
|
|
20
20
|
# Math operators
|
|
21
|
-
'\\pm' =>
|
|
22
|
-
'\\cdot' =>
|
|
23
|
-
'\\bullet' =>
|
|
24
|
-
'\\oslash' =>
|
|
21
|
+
'\\pm' => "±", '\\mp' => "∓", '\\times' => "×", '\\div' => "÷",
|
|
22
|
+
'\\cdot' => "·", '\\ast' => "∗", '\\star' => "⋆", '\\circ' => "∘",
|
|
23
|
+
'\\bullet' => "•", '\\oplus' => "⊕", '\\ominus' => "⊖", '\\otimes' => "⊗",
|
|
24
|
+
'\\oslash' => "⊘", '\\odot' => "⊙", '\\bigcirc' => "◯",
|
|
25
25
|
|
|
26
26
|
# Relations
|
|
27
|
-
'\\leq' =>
|
|
28
|
-
'\\neq' =>
|
|
29
|
-
'\\cong' =>
|
|
30
|
-
'\\ll' =>
|
|
31
|
-
'\\subset' =>
|
|
32
|
-
'\\in' =>
|
|
27
|
+
'\\leq' => "≤", '\\le' => "≤", '\\geq' => "≥", '\\ge' => "≥",
|
|
28
|
+
'\\neq' => "≠", '\\ne' => "≠", '\\equiv' => "≡", '\\approx' => "≈",
|
|
29
|
+
'\\cong' => "≅", '\\simeq' => "≃", '\\sim' => "∼", '\\propto' => "∝",
|
|
30
|
+
'\\ll' => "≪", '\\gg' => "≫", '\\asymp' => "≍",
|
|
31
|
+
'\\subset' => "⊂", '\\supset' => "⊃", '\\subseteq' => "⊆", '\\supseteq' => "⊇",
|
|
32
|
+
'\\in' => "∈", '\\ni' => "∋", '\\notin' => "∉",
|
|
33
33
|
|
|
34
34
|
# Arrows
|
|
35
|
-
'\\leftarrow' =>
|
|
36
|
-
'\\leftrightarrow' =>
|
|
37
|
-
'\\Leftrightarrow' =>
|
|
38
|
-
'\\updownarrow' =>
|
|
39
|
-
'\\Updownarrow' =>
|
|
40
|
-
'\\longrightarrow' =>
|
|
41
|
-
'\\Longleftarrow' =>
|
|
35
|
+
'\\leftarrow' => "←", '\\gets' => "←", '\\rightarrow' => "→", '\\to' => "→",
|
|
36
|
+
'\\leftrightarrow' => "↔", '\\Leftarrow' => "⇐", '\\Rightarrow' => "⇒",
|
|
37
|
+
'\\Leftrightarrow' => "⇔", '\\uparrow' => "↑", '\\downarrow' => "↓",
|
|
38
|
+
'\\updownarrow' => "↕", '\\Uparrow' => "⇑", '\\Downarrow' => "⇓",
|
|
39
|
+
'\\Updownarrow' => "⇕", '\\mapsto' => "↦", '\\longleftarrow' => "⟵",
|
|
40
|
+
'\\longrightarrow' => "⟶", '\\longleftrightarrow' => "⟷",
|
|
41
|
+
'\\Longleftarrow' => "⟸", '\\Longrightarrow' => "⟹", '\\Longleftrightarrow' => "⟺",
|
|
42
42
|
|
|
43
43
|
# Special symbols
|
|
44
|
-
'\\infty' =>
|
|
45
|
-
'\\varnothing' =>
|
|
46
|
-
'\\Im' =>
|
|
47
|
-
'\\forall' =>
|
|
48
|
-
'\\neg' =>
|
|
49
|
-
'\\wedge' =>
|
|
50
|
-
'\\top' =>
|
|
44
|
+
'\\infty' => "∞", '\\partial' => "∂", '\\nabla' => "∇", '\\emptyset' => "∅",
|
|
45
|
+
'\\varnothing' => "∅", '\\aleph' => "ℵ", '\\wp' => "℘", '\\Re' => "ℜ",
|
|
46
|
+
'\\Im' => "ℑ", '\\ell' => "ℓ", '\\hbar' => "ℏ", '\\angle' => "∠",
|
|
47
|
+
'\\forall' => "∀", '\\exists' => "∃", '\\nexists' => "∄",
|
|
48
|
+
'\\neg' => "¬", '\\lnot' => "¬", '\\land' => "∧", '\\lor' => "∨",
|
|
49
|
+
'\\wedge' => "∧", '\\vee' => "∨", '\\cap' => "∩", '\\cup' => "∪",
|
|
50
|
+
'\\top' => "⊤", '\\bot' => "⊥", '\\perp' => "⊥",
|
|
51
51
|
|
|
52
52
|
# Calculus
|
|
53
|
-
'\\int' =>
|
|
54
|
-
'\\sum' =>
|
|
53
|
+
'\\int' => "∫", '\\iint' => "∬", '\\iiint' => "∭", '\\oint' => "∮",
|
|
54
|
+
'\\sum' => "∑", '\\prod' => "∏", '\\coprod' => "∐",
|
|
55
55
|
|
|
56
56
|
# Set theory
|
|
57
|
-
'\\setminus' =>
|
|
58
|
-
'\\sqsubset' =>
|
|
57
|
+
'\\setminus' => "∖", '\\bigcap' => "⋂", '\\bigcup' => "⋃",
|
|
58
|
+
'\\sqsubset' => "⊏", '\\sqsupset' => "⊐", '\\sqsubseteq' => "⊑", '\\sqsupseteq' => "⊒",
|
|
59
59
|
|
|
60
60
|
# Logic
|
|
61
|
-
'\\vdash' =>
|
|
62
|
-
'\\therefore' =>
|
|
61
|
+
'\\vdash' => "⊢", '\\dashv' => "⊣", '\\models' => "⊨",
|
|
62
|
+
'\\therefore' => "∴", '\\because' => "∵",
|
|
63
63
|
|
|
64
64
|
# Misc
|
|
65
|
-
'\\dagger' =>
|
|
66
|
-
'\\copyright' =>
|
|
67
|
-
'\\degree' =>
|
|
68
|
-
'\\dots' =>
|
|
69
|
-
'\\vdots' =>
|
|
65
|
+
'\\dagger' => "†", '\\ddagger' => "‡", '\\S' => "§", '\\P' => "¶",
|
|
66
|
+
'\\copyright' => "©", '\\pounds' => "£", '\\yen' => "¥", '\\euro' => "€",
|
|
67
|
+
'\\degree' => "°", '\\prime' => "′", '\\dprime' => "″",
|
|
68
|
+
'\\dots' => "…", '\\ldots' => "…", '\\cdots' => "⋯",
|
|
69
|
+
'\\vdots' => "⋮", '\\ddots' => "⋱",
|
|
70
70
|
|
|
71
71
|
# Fractions (common ones)
|
|
72
|
-
'\\frac12' =>
|
|
73
|
-
'\\frac23' =>
|
|
72
|
+
'\\frac12' => "½", '\\frac13' => "⅓", '\\frac14' => "¼",
|
|
73
|
+
'\\frac23' => "⅔", '\\frac34' => "¾",
|
|
74
74
|
|
|
75
75
|
# Superscripts
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
"^0" => "⁰", "^1" => "¹", "^2" => "²", "^3" => "³", "^4" => "⁴",
|
|
77
|
+
"^5" => "⁵", "^6" => "⁶", "^7" => "⁷", "^8" => "⁸", "^9" => "⁹",
|
|
78
|
+
"^+" => "⁺", "^-" => "⁻", "^=" => "⁼", "^(" => "⁽", "^)" => "⁾",
|
|
79
|
+
"^n" => "ⁿ", "^i" => "ⁱ",
|
|
80
80
|
|
|
81
81
|
# Subscripts
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
"_0" => "₀", "_1" => "₁", "_2" => "₂", "_3" => "₃", "_4" => "₄",
|
|
83
|
+
"_5" => "₅", "_6" => "₆", "_7" => "₇", "_8" => "₈", "_9" => "₉",
|
|
84
|
+
"_+" => "₊", "_-" => "₋", "_=" => "₌", "_(" => "₍", "_)" => "₎",
|
|
85
85
|
|
|
86
86
|
# Brackets
|
|
87
|
-
'\\langle' =>
|
|
88
|
-
'\\lfloor' =>
|
|
89
|
-
'\\lbrack' =>
|
|
87
|
+
'\\langle' => "⟨", '\\rangle' => "⟩", '\\lceil' => "⌈", '\\rceil' => "⌉",
|
|
88
|
+
'\\lfloor' => "⌊", '\\rfloor' => "⌋", '\\lbrace' => "{", '\\rbrace' => "}",
|
|
89
|
+
'\\lbrack' => "[", '\\rbrack' => "]",
|
|
90
90
|
|
|
91
91
|
# Accents and modifiers (approximate)
|
|
92
|
-
'\\hat{a}' =>
|
|
93
|
-
'\\tilde{a}' =>
|
|
94
|
-
"\\'{a}" =>
|
|
95
|
-
'\\`{a}' =>
|
|
92
|
+
'\\hat{a}' => "â", '\\hat{e}' => "ê", '\\hat{i}' => "î", '\\hat{o}' => "ô", '\\hat{u}' => "û",
|
|
93
|
+
'\\tilde{a}' => "ã", '\\tilde{n}' => "ñ", '\\tilde{o}' => "õ",
|
|
94
|
+
"\\'{a}" => "á", "\\'{e}" => "é", "\\'{i}" => "í", "\\'{o}" => "ó", "\\'{u}" => "ú",
|
|
95
|
+
'\\`{a}' => "à", '\\`{e}' => "è", '\\`{i}' => "ì", '\\`{o}' => "ò", '\\`{u}' => "ù",
|
|
96
96
|
|
|
97
97
|
# Box drawing
|
|
98
|
-
'\\square' =>
|
|
99
|
-
'\\triangle' =>
|
|
100
|
-
'\\diamondsuit' =>
|
|
98
|
+
'\\square' => "□", '\\blacksquare' => "■", '\\Box' => "□",
|
|
99
|
+
'\\triangle' => "△", '\\blacktriangle' => "▲",
|
|
100
|
+
'\\diamondsuit' => "♦", '\\heartsuit' => "♥", '\\clubsuit' => "♣", '\\spadesuit' => "♠",
|
|
101
101
|
|
|
102
102
|
# Musical
|
|
103
|
-
'\\sharp' =>
|
|
103
|
+
'\\sharp' => "♯", '\\flat' => "♭", '\\natural' => "♮",
|
|
104
104
|
|
|
105
105
|
# Misc symbols
|
|
106
|
-
'\\checkmark' =>
|
|
106
|
+
'\\checkmark' => "✓", '\\maltese' => "✠",
|
|
107
107
|
|
|
108
108
|
# Blackboard bold (common sets)
|
|
109
|
-
'\\mathbb{C}' =>
|
|
110
|
-
'\\mathbb{P}' =>
|
|
111
|
-
'\\mathbb{Z}' =>
|
|
109
|
+
'\\mathbb{C}' => "ℂ", '\\mathbb{H}' => "ℍ", '\\mathbb{N}' => "ℕ",
|
|
110
|
+
'\\mathbb{P}' => "ℙ", '\\mathbb{Q}' => "ℚ", '\\mathbb{R}' => "ℝ",
|
|
111
|
+
'\\mathbb{Z}' => "ℤ",
|
|
112
112
|
|
|
113
113
|
# Additional useful symbols
|
|
114
|
-
'\\sqrt' =>
|
|
114
|
+
'\\sqrt' => "√", '\\surd' => "√"
|
|
115
115
|
}.freeze
|
|
116
116
|
|
|
117
117
|
def self.convert(text)
|
data/lib/tex_to_unicode.rb
CHANGED
metadata
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tex_to_unicode
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Thomas Powell
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A Ruby gem that converts TeX mathematical and other symbols to their
|
|
14
14
|
Unicode character equivalents, enabling easier display of mathematical notation
|
|
15
15
|
in plain text.
|
|
16
16
|
email:
|
|
17
|
-
-
|
|
17
|
+
- twilliampowell@gmail.com
|
|
18
18
|
executables:
|
|
19
19
|
- tex_to_unicode
|
|
20
20
|
extensions: []
|
|
@@ -25,12 +25,12 @@ files:
|
|
|
25
25
|
- bin/tex_to_unicode
|
|
26
26
|
- lib/tex_to_unicode.rb
|
|
27
27
|
- lib/tex_to_unicode/converter.rb
|
|
28
|
-
homepage: https://github.com/
|
|
28
|
+
homepage: https://github.com/stringsn88keys/tex_to_unicode
|
|
29
29
|
licenses:
|
|
30
30
|
- MIT
|
|
31
31
|
metadata:
|
|
32
|
-
source_code_uri: https://github.com/
|
|
33
|
-
bug_tracker_uri: https://github.com/
|
|
32
|
+
source_code_uri: https://github.com/stringsn88keys/tex_to_unicode
|
|
33
|
+
bug_tracker_uri: https://github.com/stringsn88keys/tex_to_unicode/issues
|
|
34
34
|
post_install_message:
|
|
35
35
|
rdoc_options: []
|
|
36
36
|
require_paths:
|