plurimath 0.7.2 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +3 -0
- data/Latex-Supported-Data.adoc +1 -0
- data/UnicodeMath-Supported-Data.adoc +1342 -0
- data/UnitsML-Supported-Data.adoc +444 -0
- data/lib/plurimath/asciimath/parse.rb +1 -1
- data/lib/plurimath/asciimath/transform.rb +2 -6
- data/lib/plurimath/latex/constants.rb +2 -0
- data/lib/plurimath/math/core.rb +38 -6
- data/lib/plurimath/math/formula.rb +60 -6
- data/lib/plurimath/math/function/abs.rb +4 -0
- data/lib/plurimath/math/function/arg.rb +22 -0
- data/lib/plurimath/math/function/bar.rb +4 -0
- data/lib/plurimath/math/function/base.rb +49 -0
- data/lib/plurimath/math/function/binary_function.rb +6 -0
- data/lib/plurimath/math/function/cancel.rb +5 -0
- data/lib/plurimath/math/function/ceil.rb +6 -0
- data/lib/plurimath/math/function/color.rb +20 -1
- data/lib/plurimath/math/function/ddot.rb +4 -0
- data/lib/plurimath/math/function/dot.rb +5 -0
- data/lib/plurimath/math/function/fenced.rb +98 -7
- data/lib/plurimath/math/function/floor.rb +6 -0
- data/lib/plurimath/math/function/font_style/monospace.rb +4 -0
- data/lib/plurimath/math/function/font_style.rb +31 -6
- data/lib/plurimath/math/function/frac.rb +69 -15
- data/lib/plurimath/math/function/hat.rb +4 -0
- data/lib/plurimath/math/function/inf.rb +30 -0
- data/lib/plurimath/math/function/int.rb +47 -1
- data/lib/plurimath/math/function/intent.rb +22 -0
- data/lib/plurimath/math/function/left.rb +4 -0
- data/lib/plurimath/math/function/lim.rb +6 -0
- data/lib/plurimath/math/function/limits.rb +28 -0
- data/lib/plurimath/math/function/linebreak.rb +5 -0
- data/lib/plurimath/math/function/log.rb +27 -20
- data/lib/plurimath/math/function/longdiv.rb +4 -0
- data/lib/plurimath/math/function/mbox.rb +4 -0
- data/lib/plurimath/math/function/menclose.rb +74 -5
- data/lib/plurimath/math/function/merror.rb +2 -0
- data/lib/plurimath/math/function/mglyph.rb +64 -0
- data/lib/plurimath/math/function/mlabeledtr.rb +29 -0
- data/lib/plurimath/math/function/mod.rb +4 -0
- data/lib/plurimath/math/function/mpadded.rb +84 -0
- data/lib/plurimath/math/function/ms.rb +33 -0
- data/lib/plurimath/math/function/msgroup.rb +4 -0
- data/lib/plurimath/math/function/msline.rb +2 -4
- data/lib/plurimath/math/function/multiscript.rb +70 -6
- data/lib/plurimath/math/function/nary.rb +69 -10
- data/lib/plurimath/math/function/none.rb +25 -0
- data/lib/plurimath/math/function/norm.rb +6 -0
- data/lib/plurimath/math/function/obrace.rb +4 -0
- data/lib/plurimath/math/function/oint.rb +25 -1
- data/lib/plurimath/math/function/over.rb +6 -0
- data/lib/plurimath/math/function/overset.rb +46 -1
- data/lib/plurimath/math/function/phantom.rb +18 -2
- data/lib/plurimath/math/function/power.rb +37 -0
- data/lib/plurimath/math/function/power_base.rb +45 -18
- data/lib/plurimath/math/function/prod.rb +46 -0
- data/lib/plurimath/math/function/right.rb +4 -0
- data/lib/plurimath/math/function/root.rb +9 -1
- data/lib/plurimath/math/function/rule.rb +4 -0
- data/lib/plurimath/math/function/sqrt.rb +7 -1
- data/lib/plurimath/math/function/stackrel.rb +6 -0
- data/lib/plurimath/math/function/substack.rb +4 -0
- data/lib/plurimath/math/function/sum.rb +45 -24
- data/lib/plurimath/math/function/table/bmatrix.rb +18 -5
- data/lib/plurimath/math/function/table/cases.rb +24 -0
- data/lib/plurimath/math/function/table/eqarray.rb +24 -0
- data/lib/plurimath/math/function/table/matrix.rb +23 -3
- data/lib/plurimath/math/function/table/pmatrix.rb +4 -0
- data/lib/plurimath/math/function/table/vmatrix.rb +10 -0
- data/lib/plurimath/math/function/table.rb +58 -7
- data/lib/plurimath/math/function/td.rb +9 -0
- data/lib/plurimath/math/function/ternary_function.rb +14 -1
- data/lib/plurimath/math/function/text.rb +6 -0
- data/lib/plurimath/math/function/tilde.rb +4 -0
- data/lib/plurimath/math/function/tr.rb +9 -0
- data/lib/plurimath/math/function/ubrace.rb +5 -0
- data/lib/plurimath/math/function/ul.rb +4 -0
- data/lib/plurimath/math/function/unary_function.rb +4 -0
- data/lib/plurimath/math/function/underover.rb +14 -0
- data/lib/plurimath/math/function/underset.rb +49 -1
- data/lib/plurimath/math/function/vec.rb +4 -0
- data/lib/plurimath/math/number.rb +33 -3
- data/lib/plurimath/math/symbol.rb +68 -3
- data/lib/plurimath/math.rb +3 -2
- data/lib/plurimath/mathml/constants.rb +16 -0
- data/lib/plurimath/mathml/parser.rb +42 -2
- data/lib/plurimath/mathml/transform.rb +80 -29
- data/lib/plurimath/omml/parser.rb +8 -0
- data/lib/plurimath/omml/transform.rb +29 -26
- data/lib/plurimath/unicode_math/constants.rb +1014 -0
- data/lib/plurimath/unicode_math/parse.rb +233 -0
- data/lib/plurimath/unicode_math/parser.rb +58 -0
- data/lib/plurimath/unicode_math/parsing_rules/absence_rules.rb +138 -0
- data/lib/plurimath/unicode_math/parsing_rules/common_rules.rb +114 -0
- data/lib/plurimath/unicode_math/parsing_rules/constants_rules.rb +102 -0
- data/lib/plurimath/unicode_math/parsing_rules/helper.rb +19 -0
- data/lib/plurimath/unicode_math/parsing_rules/masked.rb +62 -0
- data/lib/plurimath/unicode_math/parsing_rules/sub_sup.rb +254 -0
- data/lib/plurimath/unicode_math/transform.rb +3831 -0
- data/lib/plurimath/{unicode.rb → unicode_math.rb} +2 -2
- data/lib/plurimath/unitsml.rb +14 -1
- data/lib/plurimath/utility.rb +346 -11
- data/lib/plurimath/version.rb +1 -1
- data/lib/plurimath/xml_engine/oga.rb +5 -0
- data/lib/plurimath/xml_engine/ox.rb +5 -0
- metadata +25 -3
@@ -0,0 +1,1014 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Plurimath
|
4
|
+
class UnicodeMath
|
5
|
+
class Constants
|
6
|
+
UNARY_FUNCTIONS = %w[
|
7
|
+
cos
|
8
|
+
cot
|
9
|
+
csc
|
10
|
+
sec
|
11
|
+
sin
|
12
|
+
tan
|
13
|
+
arg
|
14
|
+
def
|
15
|
+
deg
|
16
|
+
det
|
17
|
+
dim
|
18
|
+
erf
|
19
|
+
exp
|
20
|
+
gcd
|
21
|
+
hom
|
22
|
+
inf
|
23
|
+
ker
|
24
|
+
lim
|
25
|
+
log
|
26
|
+
max
|
27
|
+
min
|
28
|
+
mod
|
29
|
+
sup
|
30
|
+
Im
|
31
|
+
Pr
|
32
|
+
Re
|
33
|
+
ln
|
34
|
+
tg
|
35
|
+
].freeze
|
36
|
+
|
37
|
+
UNDEF_UNARY_FUNCTIONS = %w[
|
38
|
+
arg
|
39
|
+
def
|
40
|
+
erf
|
41
|
+
Im
|
42
|
+
Pr
|
43
|
+
Re
|
44
|
+
tg
|
45
|
+
].freeze
|
46
|
+
|
47
|
+
BINARY_FUNCTIONS = %w[
|
48
|
+
obrace
|
49
|
+
oint
|
50
|
+
prod
|
51
|
+
sum
|
52
|
+
int
|
53
|
+
lim
|
54
|
+
inf
|
55
|
+
log
|
56
|
+
].freeze
|
57
|
+
|
58
|
+
UNARY_SYMBOLS = {
|
59
|
+
underline: "▁",
|
60
|
+
hphantom: "⬄",
|
61
|
+
vphantom: "⇳",
|
62
|
+
underbar: "▁",
|
63
|
+
overline: "¯",
|
64
|
+
phantom: "⟡",
|
65
|
+
longdiv: "⟌",
|
66
|
+
circle: "○",
|
67
|
+
asmash: "⬆",
|
68
|
+
dsmash: "⬇",
|
69
|
+
hsmash: "⬌",
|
70
|
+
smash: "⬍",
|
71
|
+
overbar: "¯",
|
72
|
+
}.freeze
|
73
|
+
|
74
|
+
PHANTOM_SYMBOLS = {
|
75
|
+
hphantom: { mpadded: { depth: "0", height: "0" }, phantom: true },
|
76
|
+
vphantom: { mpadded: { width: "0" }, phantom: true },
|
77
|
+
phantom: { phantom: true },
|
78
|
+
hsmash: { mpadded: { width: "0" }, phantom: false },
|
79
|
+
asmash: { mpadded: { height: "0" }, phantom: false },
|
80
|
+
dsmash: { mpadded: { depth: "0" }, phantom: false },
|
81
|
+
smash: { mpadded: { height: "0", depth: "0" }, phantom: false }
|
82
|
+
}.freeze
|
83
|
+
|
84
|
+
BINARY_SYMBOLS = {
|
85
|
+
ast: "∗",
|
86
|
+
boxdot: "⊡",
|
87
|
+
boxminus: "⊟",
|
88
|
+
boxplus: "⊞",
|
89
|
+
boxtimes: "⊠",
|
90
|
+
bullet: "∙",
|
91
|
+
Cap: "⋒",
|
92
|
+
cap: "∩",
|
93
|
+
cdot: "⋅",
|
94
|
+
circ: "∘",
|
95
|
+
Cup: "⋓",
|
96
|
+
cup: "∪",
|
97
|
+
curlyvee: "⋎",
|
98
|
+
curlywedge: "⋏",
|
99
|
+
diamond: "⋄",
|
100
|
+
div: "÷",
|
101
|
+
divideontimes: "Ç",
|
102
|
+
dotminus: "∸",
|
103
|
+
dotplus: "∔",
|
104
|
+
funcapply: "⁡",
|
105
|
+
intercal: "⊺",
|
106
|
+
leftthreetimes: "⋋",
|
107
|
+
lor: "∨",
|
108
|
+
ltimes: "⋉",
|
109
|
+
oast: "⊛",
|
110
|
+
ocirc: "⊚",
|
111
|
+
odash: "⊝",
|
112
|
+
odot: "⊙",
|
113
|
+
oeq: "⊜",
|
114
|
+
ominus: "⊖",
|
115
|
+
oplus: "⊕",
|
116
|
+
otimes: "⊗",
|
117
|
+
pitchfork: "⋔",
|
118
|
+
rightthreetimes: "⋌",
|
119
|
+
rtimes: "⋊",
|
120
|
+
setminus: "∖",
|
121
|
+
sqcap: "⊓",
|
122
|
+
sqcup: "⊔",
|
123
|
+
star: "⋆",
|
124
|
+
times: "×",
|
125
|
+
triangle: "△",
|
126
|
+
uplus: "⊎",
|
127
|
+
wedge: "∧",
|
128
|
+
neq: "≠",
|
129
|
+
wr: "≀",
|
130
|
+
ne: "≠",
|
131
|
+
dd: "ⅆ",
|
132
|
+
}.freeze
|
133
|
+
|
134
|
+
NARY_CLASSES = {
|
135
|
+
prod: "∏",
|
136
|
+
oint: "∮",
|
137
|
+
int: "∫",
|
138
|
+
sum: "∑",
|
139
|
+
}.freeze
|
140
|
+
|
141
|
+
NARY_SYMBOLS = {
|
142
|
+
amalg: "∐",
|
143
|
+
aoint: "∳",
|
144
|
+
bigcap: "⋂",
|
145
|
+
bigcup: "⋃",
|
146
|
+
bigodot: "⨀",
|
147
|
+
bigoplus: "⨁",
|
148
|
+
bigotimes: "⨂",
|
149
|
+
bigsqcap: "⨅",
|
150
|
+
bigsqcup: "⨆",
|
151
|
+
bigudot: "⨀",
|
152
|
+
biguplus: "⨄",
|
153
|
+
bigvee: "⋁",
|
154
|
+
bigwedge: "⋀",
|
155
|
+
coint: "∲",
|
156
|
+
coprod: "∐",
|
157
|
+
cwint: "∱",
|
158
|
+
iiiint: "⨌",
|
159
|
+
iiint: "∭",
|
160
|
+
iint: "∬",
|
161
|
+
int: "∫",
|
162
|
+
oiiint: "∰",
|
163
|
+
oiint: "∯",
|
164
|
+
oint: "∮",
|
165
|
+
prod: "∏",
|
166
|
+
sum: "∑",
|
167
|
+
}.freeze
|
168
|
+
|
169
|
+
OPEN_SYMBOLS = {
|
170
|
+
begin: "〖",
|
171
|
+
bra: "⟨",
|
172
|
+
Langle: "⟪",
|
173
|
+
langle: "⟨",
|
174
|
+
lbbrack: "⟦",
|
175
|
+
lbrace: "{",
|
176
|
+
Lbrack: "⟦",
|
177
|
+
lbrack: "[",
|
178
|
+
lceil: "⌈",
|
179
|
+
lfloor: "⌊",
|
180
|
+
}.freeze
|
181
|
+
|
182
|
+
CLOSE_SYMBOLS = {
|
183
|
+
end: "〗",
|
184
|
+
ket: "⟩",
|
185
|
+
Rangle: "⟫",
|
186
|
+
rangle: "⟩",
|
187
|
+
rbbrack: "⟧",
|
188
|
+
rbace: "}",
|
189
|
+
Rbrack: "⟧",
|
190
|
+
rbrack: "]",
|
191
|
+
rceil: "⌉",
|
192
|
+
rfloor: "⌋",
|
193
|
+
}.freeze
|
194
|
+
|
195
|
+
RELATIONAL_SYMBOLS = {
|
196
|
+
angmsd: "∡",
|
197
|
+
angrtvb: "⊾",
|
198
|
+
angsph: "∢",
|
199
|
+
approx: "≈",
|
200
|
+
approxeq: "≊",
|
201
|
+
asymp: "≍",
|
202
|
+
backsim: "∽",
|
203
|
+
backsimeq: "⋍",
|
204
|
+
because: "∵",
|
205
|
+
between: "≬",
|
206
|
+
bot: "⊥",
|
207
|
+
bowtie: "⋈",
|
208
|
+
bumpeq: "≏",
|
209
|
+
circeq: "≗",
|
210
|
+
circlearrowleft: "↺",
|
211
|
+
circlearrowright: "↻",
|
212
|
+
delta: "δ",
|
213
|
+
Delta: "Δ",
|
214
|
+
Colon: "∷",
|
215
|
+
colon: "∶",
|
216
|
+
cong: "≅",
|
217
|
+
curlyeqprec: "⋞",
|
218
|
+
curlyeqsucc: "⋟",
|
219
|
+
curvearrowleft: "⇠",
|
220
|
+
dasharrowright: "⇫",
|
221
|
+
dashv: "⊣",
|
222
|
+
ddots: "⋱",
|
223
|
+
Doteq: "≑",
|
224
|
+
doteq: "≐",
|
225
|
+
Downarrow: "⇓",
|
226
|
+
downarrow: "↓",
|
227
|
+
downarrows: "⇊",
|
228
|
+
downharpoonleft: "⇃",
|
229
|
+
downharpoonright: "⇂",
|
230
|
+
eqcirc: "≖",
|
231
|
+
eqgtr: "⋝",
|
232
|
+
equiv: "≡",
|
233
|
+
fallingdotseq: "≒",
|
234
|
+
ge: "≥",
|
235
|
+
geq: "≥",
|
236
|
+
geqq: "≧",
|
237
|
+
gg: "≫",
|
238
|
+
ggg: "⋙",
|
239
|
+
gneqq: "≩",
|
240
|
+
gtrdot: "⋗",
|
241
|
+
gtreqless: "⋛",
|
242
|
+
gtrless: "≷",
|
243
|
+
gtrsim: "≳",
|
244
|
+
hookleftarrow: "↩",
|
245
|
+
hookrightarrow: "↪",
|
246
|
+
iff: "⟿",
|
247
|
+
in: "∈",
|
248
|
+
le: "≤",
|
249
|
+
Leftarrow: "⇐",
|
250
|
+
leftarrow: "←",
|
251
|
+
leftarrowtail: "↢",
|
252
|
+
leftharpoondown: "↽",
|
253
|
+
leftharpoonup: "↼",
|
254
|
+
leftleftarrows: "⇇",
|
255
|
+
Leftrightarrow: "⇔",
|
256
|
+
leftrightarrow: "↔",
|
257
|
+
leftrightarrows: "⇆",
|
258
|
+
leftrightharpoons: "⇋",
|
259
|
+
leftrightwavearrow: "↭",
|
260
|
+
leftsquigarrow: "⇜",
|
261
|
+
leftwavearrow: "↜",
|
262
|
+
leq: "≤",
|
263
|
+
leqq: "≦",
|
264
|
+
lessdot: "⋖",
|
265
|
+
lesseqgtr: "⋚",
|
266
|
+
lessgtr: "≶",
|
267
|
+
lesssim: "≲",
|
268
|
+
ll: "≪",
|
269
|
+
lmoust: "⊰",
|
270
|
+
lneq: "≨",
|
271
|
+
# lnot: "¬",
|
272
|
+
lnsim: "⋦",
|
273
|
+
Longleftarrow: "⟸",
|
274
|
+
longleftarrow: "⟵",
|
275
|
+
Longleftrightarrow: "⟺",
|
276
|
+
Longrightarrow: "⟹",
|
277
|
+
longrightarrow: "⟶",
|
278
|
+
looparrowleft: "↬",
|
279
|
+
lrhar: "⇋",
|
280
|
+
mapsto: "↦",
|
281
|
+
mapstoleft: "↤",
|
282
|
+
models: "⊨",
|
283
|
+
multimap: "⊸",
|
284
|
+
napprox: "≉",
|
285
|
+
nasymp: "≭",
|
286
|
+
ncong: "≇",
|
287
|
+
nearrow: "↗",
|
288
|
+
nequiv: "≢",
|
289
|
+
ngeq: "≱",
|
290
|
+
ngt: "≯",
|
291
|
+
ni: "∋",
|
292
|
+
nLeftarrow: "⇍",
|
293
|
+
nleftarrow: "↚",
|
294
|
+
nLeftrightarrow: "⇎",
|
295
|
+
nleftrightarrow: "↮",
|
296
|
+
nleq: "≰",
|
297
|
+
nless: "≮",
|
298
|
+
nmid: "∤",
|
299
|
+
notin: "∉",
|
300
|
+
notni: "∌",
|
301
|
+
nparallel: "∦",
|
302
|
+
nprec: "⊀",
|
303
|
+
npreccurlyeq: "⋠",
|
304
|
+
nRightarrow: "⇏",
|
305
|
+
nrightarrow: "↛",
|
306
|
+
nsim: "≁",
|
307
|
+
nsimeq: "≄",
|
308
|
+
nsqsubseteq: "⋢",
|
309
|
+
nsqsuperseteq: "⋣",
|
310
|
+
nsub: "⊄",
|
311
|
+
subseteq: "⊈",
|
312
|
+
nsucc: "⊁",
|
313
|
+
nsucccurlyeq: "⋡",
|
314
|
+
nsup: "⊅",
|
315
|
+
nsupseteq: "⊈",
|
316
|
+
ntriangleleft: "⋪",
|
317
|
+
ntriangleright: "⋫",
|
318
|
+
ntrianglerighteq: "⋭",
|
319
|
+
nVdash: "⊭",
|
320
|
+
nvdash: "⊬",
|
321
|
+
nwarrow: "↖",
|
322
|
+
parallel: "↖",
|
323
|
+
perp: "⊥",
|
324
|
+
prcue: "≼",
|
325
|
+
prec: "≺",
|
326
|
+
preccurlyeq: "≼",
|
327
|
+
preceq: "⪯",
|
328
|
+
precnsim: "⋨",
|
329
|
+
precsim: "≾",
|
330
|
+
propto: "∝",
|
331
|
+
ratio: "∝",
|
332
|
+
rddots: "⋰",
|
333
|
+
rdsh: "↳",
|
334
|
+
Rightarrow: "⇒",
|
335
|
+
rightarrow: "→",
|
336
|
+
rightarrowtail: "↣",
|
337
|
+
rightharpoondown: "⇁",
|
338
|
+
rightharpoonup: "⇀",
|
339
|
+
rightleftarrows: "⇄",
|
340
|
+
rightleftharpoons: "⇌",
|
341
|
+
rightrightarrows: "⇉",
|
342
|
+
rightsquigarrow: "⇝",
|
343
|
+
rightwavearrow: "↝",
|
344
|
+
risingdotseq: "≓",
|
345
|
+
rlhar: "⇌",
|
346
|
+
rmoust: "⎱",
|
347
|
+
searrow: "↘",
|
348
|
+
sim: "∼",
|
349
|
+
simeq: "≃",
|
350
|
+
sqsubset: "⊏",
|
351
|
+
sqsubseteq: "⊑",
|
352
|
+
sqsupset: "⊐",
|
353
|
+
sqsupseteq: "⊒",
|
354
|
+
Subset: "⋐",
|
355
|
+
subset: "⊂",
|
356
|
+
subsetneq: "⊊",
|
357
|
+
subsub: "⫓",
|
358
|
+
succ: "≻",
|
359
|
+
succcurlyeq: "≽",
|
360
|
+
succeq: "⪰",
|
361
|
+
succnsim: "⋩",
|
362
|
+
succsim: "≿",
|
363
|
+
Supset: "⋑",
|
364
|
+
supset: "⊃",
|
365
|
+
supseteq: "⊇",
|
366
|
+
supsetneq: "⊋",
|
367
|
+
supsub: "⫔",
|
368
|
+
supsup: "⫖",
|
369
|
+
swarrow: "↙",
|
370
|
+
therefore: "∴",
|
371
|
+
to: "→",
|
372
|
+
top: "⊤",
|
373
|
+
trianglelefteq: "⊴",
|
374
|
+
trianglerighteq: "⊵",
|
375
|
+
twoheadleftarrow: "↞",
|
376
|
+
twoheadrightarrow: "↠",
|
377
|
+
Uparrow: "⇑",
|
378
|
+
uparrow: "↑",
|
379
|
+
Updownarrow: "⇕",
|
380
|
+
updownarrow: "↕",
|
381
|
+
updownarrows: "⇅",
|
382
|
+
upharpoonleft: "↿",
|
383
|
+
upharpoonright: "↾",
|
384
|
+
upuparrows: "⇈",
|
385
|
+
vartriangleleft: "⊲",
|
386
|
+
vartriangleright: "⊳",
|
387
|
+
VDash: "⊫",
|
388
|
+
Vdash: "⊩",
|
389
|
+
vdash: "⊢",
|
390
|
+
vdots: "⋮",
|
391
|
+
Vvdash: "⊪",
|
392
|
+
}.freeze
|
393
|
+
|
394
|
+
HORIZONTAL_BRACKETS = {
|
395
|
+
underbracket: "⎵",
|
396
|
+
overbracket: "⎴",
|
397
|
+
undershell: "⏡",
|
398
|
+
underparen: "⏝",
|
399
|
+
underbrace: "⏟",
|
400
|
+
overshell: "⏠",
|
401
|
+
overparen: "⏜",
|
402
|
+
overbrace: "⏞",
|
403
|
+
}.freeze
|
404
|
+
|
405
|
+
UNDER_HORIZONTAL_BRACKETS = {
|
406
|
+
underbracket: "⎵",
|
407
|
+
undershell: "⏡",
|
408
|
+
underparen: "⏝",
|
409
|
+
underbrace: "⏟",
|
410
|
+
}.freeze
|
411
|
+
|
412
|
+
ORDINARY_SYMBOLS = {
|
413
|
+
diamondsuit: "♤",
|
414
|
+
varepsilon: "ε",
|
415
|
+
rightangle: "∠",
|
416
|
+
complement: "∁",
|
417
|
+
spadesuit: "♠",
|
418
|
+
emptyset: "∅",
|
419
|
+
vartheta: "ϑ",
|
420
|
+
varsigma: "ς",
|
421
|
+
varkappa: "ϰ",
|
422
|
+
hearsuit: "♡",
|
423
|
+
clubsuit: "♣",
|
424
|
+
partial: "∂",
|
425
|
+
nexists: "∄",
|
426
|
+
upsilon: "υ",
|
427
|
+
Upsilon: "Υ",
|
428
|
+
epsilon: "ϵ",
|
429
|
+
Deltaeq: "≜",
|
430
|
+
varrho: "ϱ",
|
431
|
+
forall: "∀",
|
432
|
+
exists: "∃",
|
433
|
+
varphi: "φ",
|
434
|
+
lambda: "λ",
|
435
|
+
Lambda: "Λ",
|
436
|
+
frown: "⌢",
|
437
|
+
nabla: "∇",
|
438
|
+
angle: "∠",
|
439
|
+
daleth: "ℸ",
|
440
|
+
varpi: "ϖ",
|
441
|
+
theta: "θ",
|
442
|
+
Theta: "Θ",
|
443
|
+
sigma: "σ",
|
444
|
+
Sigma: "Σ",
|
445
|
+
omega: "ω",
|
446
|
+
Omega: "Ω",
|
447
|
+
medsp: " ",
|
448
|
+
ldots: "…",
|
449
|
+
kappa: "κ",
|
450
|
+
jmath: "ȷ",
|
451
|
+
infty: "∞",
|
452
|
+
imath: "ı",
|
453
|
+
gimel: "ℷ",
|
454
|
+
gamma: "γ",
|
455
|
+
Gamma: "Γ",
|
456
|
+
cdots: "⏯",
|
457
|
+
alpha: "α",
|
458
|
+
aleph: "ℵ",
|
459
|
+
"...": "…",
|
460
|
+
Vert: "‖",
|
461
|
+
norm: "‖",
|
462
|
+
zwsp: "​",
|
463
|
+
zwnj: "‌",
|
464
|
+
zeta: "ζ",
|
465
|
+
vbar: "│",
|
466
|
+
ldsh: "↲",
|
467
|
+
iota: "ι",
|
468
|
+
hbar: "ℏ",
|
469
|
+
gets: "←",
|
470
|
+
degree: "°",
|
471
|
+
epar: "⋥",
|
472
|
+
dots: "…",
|
473
|
+
degf: "℉",
|
474
|
+
degc: "℃",
|
475
|
+
ddag: "‡",
|
476
|
+
beth: "ℶ",
|
477
|
+
beta: "ʲ",
|
478
|
+
inc: "∆",
|
479
|
+
tau: "τ",
|
480
|
+
rho: "ρ",
|
481
|
+
qed: "∎",
|
482
|
+
psi: "ψ",
|
483
|
+
Psi: "Ψ",
|
484
|
+
phi: "ϕ",
|
485
|
+
Phi: "Φ",
|
486
|
+
eta: "η",
|
487
|
+
ell: "ℓ",
|
488
|
+
dag: "†",
|
489
|
+
chi: "χ",
|
490
|
+
box: "□",
|
491
|
+
vert: "|",
|
492
|
+
eqno: "#",
|
493
|
+
mp: "∓",
|
494
|
+
xi: "ξ",
|
495
|
+
wp: "℘",
|
496
|
+
Re: "ℜ",
|
497
|
+
pi: "π",
|
498
|
+
Pi: "Π",
|
499
|
+
oo: "ω",
|
500
|
+
nu: "ν",
|
501
|
+
mu: "μ",
|
502
|
+
jj: "ⅉ",
|
503
|
+
Im: "ℑ",
|
504
|
+
ii: "ⅈ",
|
505
|
+
ee: "ⅇ",
|
506
|
+
neg: "¬",
|
507
|
+
pm: "±",
|
508
|
+
}.freeze
|
509
|
+
|
510
|
+
SKIP_SYMBOLS = {
|
511
|
+
vthicksp: " ",
|
512
|
+
thicksp: " ",
|
513
|
+
thinsp: " ",
|
514
|
+
hairsp: " ",
|
515
|
+
numsp: " ",
|
516
|
+
quad: " ",
|
517
|
+
ensp: " ",
|
518
|
+
emsp: " ",
|
519
|
+
nbsp: " ",
|
520
|
+
}.freeze
|
521
|
+
|
522
|
+
OPEN_PARENTHESIS = [
|
523
|
+
"[",
|
524
|
+
"(",
|
525
|
+
"{",
|
526
|
+
].freeze
|
527
|
+
|
528
|
+
CLOSE_PARENTHESIS = [
|
529
|
+
"]",
|
530
|
+
")",
|
531
|
+
"}",
|
532
|
+
].freeze
|
533
|
+
|
534
|
+
NEGATABLE_SYMBOLS = %w[
|
535
|
+
"⊒"
|
536
|
+
"⊑"
|
537
|
+
"⊇"
|
538
|
+
"⊆"
|
539
|
+
"⊃"
|
540
|
+
"⊂"
|
541
|
+
"≼"
|
542
|
+
"≻"
|
543
|
+
"≺"
|
544
|
+
"≽"
|
545
|
+
"≷"
|
546
|
+
"≶"
|
547
|
+
"≥"
|
548
|
+
"≤"
|
549
|
+
"≡"
|
550
|
+
"≍"
|
551
|
+
"≈"
|
552
|
+
"≅"
|
553
|
+
"≃"
|
554
|
+
"∼"
|
555
|
+
"∋"
|
556
|
+
"∈"
|
557
|
+
"∃"
|
558
|
+
">"
|
559
|
+
"<"
|
560
|
+
"¬"
|
561
|
+
~
|
562
|
+
=
|
563
|
+
+
|
564
|
+
-
|
565
|
+
].freeze
|
566
|
+
|
567
|
+
PREFIXED_NEGATABLE_SYMBOLS = %w[
|
568
|
+
sqsupseteq
|
569
|
+
sqsubseteq
|
570
|
+
supseteq
|
571
|
+
subseteq
|
572
|
+
emptyset
|
573
|
+
gtrless
|
574
|
+
lessgtr
|
575
|
+
nexists
|
576
|
+
approx
|
577
|
+
exists
|
578
|
+
supset
|
579
|
+
subset
|
580
|
+
forall
|
581
|
+
preceq
|
582
|
+
succeq
|
583
|
+
simeq
|
584
|
+
equiv
|
585
|
+
frown
|
586
|
+
nabla
|
587
|
+
angle
|
588
|
+
asymp
|
589
|
+
succ
|
590
|
+
prec
|
591
|
+
cong
|
592
|
+
neg
|
593
|
+
inc
|
594
|
+
sim
|
595
|
+
ge
|
596
|
+
le
|
597
|
+
ni
|
598
|
+
in
|
599
|
+
].freeze
|
600
|
+
|
601
|
+
ACCENT_SYMBOLS = {
|
602
|
+
widetilde: "̃",
|
603
|
+
widehat: "̂",
|
604
|
+
ddddot: "⃜",
|
605
|
+
breve: "̆",
|
606
|
+
check: "̌",
|
607
|
+
tilde: "̃",
|
608
|
+
lhvec: "⃐",
|
609
|
+
rhvec: "⃑",
|
610
|
+
grave: "̀",
|
611
|
+
dddot: "⃛",
|
612
|
+
acute: "́",
|
613
|
+
ddot: "̈",
|
614
|
+
lvec: "⃖",
|
615
|
+
hvec: "⃑",
|
616
|
+
ubar: "̲",
|
617
|
+
tvec: "⃡",
|
618
|
+
dot: "̇",
|
619
|
+
Bar: "̿",
|
620
|
+
bar: "̅",
|
621
|
+
hat: "̂",
|
622
|
+
vec: "⃗",
|
623
|
+
}.freeze
|
624
|
+
|
625
|
+
UNARY_ARG_FUNCTIONS = {
|
626
|
+
bcancel: "╲",
|
627
|
+
xcancel: "╳",
|
628
|
+
ellipse: "⬭",
|
629
|
+
cancel: "╱",
|
630
|
+
rrect: "▢",
|
631
|
+
rect: "▭",
|
632
|
+
abs: "⒜",
|
633
|
+
}.freeze
|
634
|
+
|
635
|
+
FONTS_CLASSES = %w[
|
636
|
+
mbfitsans
|
637
|
+
mbffrak
|
638
|
+
mitsans
|
639
|
+
mbfsans
|
640
|
+
mbfscr
|
641
|
+
mfrak
|
642
|
+
msans
|
643
|
+
mbfit
|
644
|
+
mscr
|
645
|
+
Bbb
|
646
|
+
mup
|
647
|
+
mbf
|
648
|
+
mit
|
649
|
+
mtt
|
650
|
+
].freeze
|
651
|
+
|
652
|
+
ALPHANUMERIC_FONTS_CLASSES = %w[
|
653
|
+
mbfsans
|
654
|
+
msans
|
655
|
+
Bbb
|
656
|
+
mtt
|
657
|
+
mbf
|
658
|
+
mup
|
659
|
+
].freeze
|
660
|
+
|
661
|
+
SIZE_OVERRIDES_SYMBOLS = {
|
662
|
+
A: "1.25em",
|
663
|
+
B: "1.5625em",
|
664
|
+
C: "0.8em",
|
665
|
+
D: "0.64em",
|
666
|
+
}.freeze
|
667
|
+
|
668
|
+
DIACRITIC_OVERLAYS = [
|
669
|
+
'⃫',
|
670
|
+
'⃪',
|
671
|
+
'⃦',
|
672
|
+
'⃥',
|
673
|
+
'⃤',
|
674
|
+
'⃣',
|
675
|
+
'⃢',
|
676
|
+
'⃠',
|
677
|
+
'⃟',
|
678
|
+
'⃞',
|
679
|
+
'⃝',
|
680
|
+
'⃚',
|
681
|
+
'⃙',
|
682
|
+
'⃘',
|
683
|
+
'⃓',
|
684
|
+
'⃒',
|
685
|
+
'̉',
|
686
|
+
'̄',
|
687
|
+
'̸',
|
688
|
+
'̷',
|
689
|
+
'̶',
|
690
|
+
'̵',
|
691
|
+
'̴',
|
692
|
+
].freeze
|
693
|
+
|
694
|
+
OVERLAYS_NOTATIONS = {
|
695
|
+
'⃫': "mover",
|
696
|
+
'⃪': "mover",
|
697
|
+
'⃦': "mover",
|
698
|
+
'⃥': "mover",
|
699
|
+
'⃤': "mover",
|
700
|
+
'⃣': "mover",
|
701
|
+
'⃢': "mover",
|
702
|
+
'⃠': "circle downdiagonalstrike",
|
703
|
+
'⃟': "mover",
|
704
|
+
'⃞': "box",
|
705
|
+
'⃝': "circle",
|
706
|
+
'⃚': "mover",
|
707
|
+
'⃙': "mover",
|
708
|
+
'⃔': "mover",
|
709
|
+
'⃖': "mover",
|
710
|
+
'⃕': "mover",
|
711
|
+
'⃘': "mover",
|
712
|
+
'⃓': "mover",
|
713
|
+
'⃒': "mover",
|
714
|
+
'̄': "top",
|
715
|
+
'̸': "mover",
|
716
|
+
'̷': "mover",
|
717
|
+
'̶': "mover",
|
718
|
+
'̵': "mover",
|
719
|
+
'̴': "mover",
|
720
|
+
'̉': "mover",
|
721
|
+
}.freeze
|
722
|
+
|
723
|
+
DIACRITIC_BELOWS = [
|
724
|
+
'̖',
|
725
|
+
'̗',
|
726
|
+
'̘',
|
727
|
+
'̙',
|
728
|
+
'̜',
|
729
|
+
'̝',
|
730
|
+
'̞',
|
731
|
+
'̟',
|
732
|
+
'̠',
|
733
|
+
'̡',
|
734
|
+
'̢',
|
735
|
+
'̣',
|
736
|
+
'̤',
|
737
|
+
'̥',
|
738
|
+
'̦',
|
739
|
+
'̧',
|
740
|
+
'̨',
|
741
|
+
'̩',
|
742
|
+
'̪',
|
743
|
+
'̫',
|
744
|
+
'̬',
|
745
|
+
'̭',
|
746
|
+
'̮',
|
747
|
+
'̯',
|
748
|
+
'̰',
|
749
|
+
'̱',
|
750
|
+
'̲',
|
751
|
+
'̳',
|
752
|
+
'̹',
|
753
|
+
'̺',
|
754
|
+
'̻',
|
755
|
+
'̼',
|
756
|
+
'ͅ',
|
757
|
+
'͇',
|
758
|
+
'͈',
|
759
|
+
'͉',
|
760
|
+
'͍',
|
761
|
+
'͎',
|
762
|
+
'͓',
|
763
|
+
'͔',
|
764
|
+
'͕',
|
765
|
+
'͖',
|
766
|
+
'͙',
|
767
|
+
'͚',
|
768
|
+
'͜',
|
769
|
+
'͟',
|
770
|
+
'͢',
|
771
|
+
'⃨',
|
772
|
+
'⃬',
|
773
|
+
'⃭',
|
774
|
+
'⃮',
|
775
|
+
'⃯',
|
776
|
+
].freeze
|
777
|
+
|
778
|
+
BELOWS_NOTATIONS = {
|
779
|
+
'̖': "munder",
|
780
|
+
'̗': "munder",
|
781
|
+
'̘': "munder",
|
782
|
+
'̙': "munder",
|
783
|
+
'̜': "munder",
|
784
|
+
'̝': "munder",
|
785
|
+
'̞': "munder",
|
786
|
+
'̟': "munder",
|
787
|
+
'̠': "munder",
|
788
|
+
'̡': "munder",
|
789
|
+
'̢': "munder",
|
790
|
+
'̣': "munder",
|
791
|
+
'̤': "munder",
|
792
|
+
'̥': "munder",
|
793
|
+
'̦': "munder",
|
794
|
+
'̧': "munder",
|
795
|
+
'̨': "munder",
|
796
|
+
'̩': "munder",
|
797
|
+
'̪': "munder",
|
798
|
+
'̫': "munder",
|
799
|
+
'̬': "munder",
|
800
|
+
'̭': "munder",
|
801
|
+
'̮': "munder",
|
802
|
+
'̯': "munder",
|
803
|
+
'̰': "munder",
|
804
|
+
'̱': "munder",
|
805
|
+
'̲': "bottom",
|
806
|
+
'̳': "munder",
|
807
|
+
'̹': "munder",
|
808
|
+
'̺': "munder",
|
809
|
+
'̻': "munder",
|
810
|
+
'̼': "munder",
|
811
|
+
'ͅ': "munder",
|
812
|
+
'͇': "munder",
|
813
|
+
'͈': "munder",
|
814
|
+
'͉': "munder",
|
815
|
+
'͍': "munder",
|
816
|
+
'͎': "munder",
|
817
|
+
'͓': "munder",
|
818
|
+
'͔': "munder",
|
819
|
+
'͕': "munder",
|
820
|
+
'͖': "munder",
|
821
|
+
'͙': "munder",
|
822
|
+
'͚': "munder",
|
823
|
+
'͜': "munder",
|
824
|
+
'͟': "munder",
|
825
|
+
'͢': "munder",
|
826
|
+
'⃨': "munder",
|
827
|
+
'⃬': "munder",
|
828
|
+
'⃭': "munder",
|
829
|
+
'⃮': "munder",
|
830
|
+
'⃯': "munder",
|
831
|
+
}.freeze
|
832
|
+
|
833
|
+
SUP_DIGITS = {
|
834
|
+
"0": "⁰",
|
835
|
+
"1": "¹",
|
836
|
+
"2": "²",
|
837
|
+
"3": "³",
|
838
|
+
"4": "⁴",
|
839
|
+
"5": "⁵",
|
840
|
+
"6": "⁶",
|
841
|
+
"7": "⁷",
|
842
|
+
"8": "⁸",
|
843
|
+
"9": "⁹"
|
844
|
+
}.freeze
|
845
|
+
|
846
|
+
SUB_DIGITS = {
|
847
|
+
"0": "₀",
|
848
|
+
"1": "₁",
|
849
|
+
"2": "₂",
|
850
|
+
"3": "₃",
|
851
|
+
"4": "₄",
|
852
|
+
"5": "₅",
|
853
|
+
"6": "₆",
|
854
|
+
"7": "₇",
|
855
|
+
"8": "₈",
|
856
|
+
"9": "₉",
|
857
|
+
}.freeze
|
858
|
+
|
859
|
+
SUB_ALPHABETS = {
|
860
|
+
"a": "ₐ",
|
861
|
+
"e": "ₑ",
|
862
|
+
"h": "ₕ",
|
863
|
+
"i": "ᵢ",
|
864
|
+
"j": "ⱼ",
|
865
|
+
"k": "ₖ",
|
866
|
+
"l": "ₗ",
|
867
|
+
"m": "ₘ",
|
868
|
+
"n": "ₙ",
|
869
|
+
"o": "ₒ",
|
870
|
+
"p": "ₚ",
|
871
|
+
"r": "ᵣ",
|
872
|
+
"s": "ₛ",
|
873
|
+
"t": "ₜ",
|
874
|
+
"u": "ᵤ",
|
875
|
+
"v": "ᵥ",
|
876
|
+
"x": "ₓ"
|
877
|
+
}.freeze
|
878
|
+
|
879
|
+
SUP_ALPHABETS = {
|
880
|
+
"a": "ᵃ",
|
881
|
+
"b": "ᵇ",
|
882
|
+
"c": "ᶜ",
|
883
|
+
"d": "ᵈ",
|
884
|
+
"e": "ᵉ",
|
885
|
+
"f": "ᶠ",
|
886
|
+
"g": "ᵍ",
|
887
|
+
"h": "ʰ",
|
888
|
+
"i": "ⁱ",
|
889
|
+
"j": "ʲ",
|
890
|
+
"k": "ᵏ",
|
891
|
+
"l": "ˡ",
|
892
|
+
"m": "ᵐ",
|
893
|
+
"n": "ⁿ",
|
894
|
+
"o": "ᵒ",
|
895
|
+
"p": "ᵖ",
|
896
|
+
"r": "ʳ",
|
897
|
+
"s": "ˢ",
|
898
|
+
"t": "ᵗ",
|
899
|
+
"u": "ᵘ",
|
900
|
+
"v": "ᵛ",
|
901
|
+
"w": "ʷ",
|
902
|
+
"x": "ˣ",
|
903
|
+
"y": "ʸ",
|
904
|
+
"z": "ᶻ"
|
905
|
+
}.freeze
|
906
|
+
|
907
|
+
SUB_OPERATORS = {
|
908
|
+
"+": "₊",
|
909
|
+
"-": "₋",
|
910
|
+
"=": "₌",
|
911
|
+
"ₔ": "ₔ",
|
912
|
+
}.freeze
|
913
|
+
|
914
|
+
SUP_OPERATORS = {
|
915
|
+
"+": "⁺",
|
916
|
+
"-": "⁻",
|
917
|
+
"=": "⁼",
|
918
|
+
}.freeze
|
919
|
+
|
920
|
+
SUB_PARENTHESIS = {
|
921
|
+
open: {
|
922
|
+
"(": "₍",
|
923
|
+
},
|
924
|
+
close: {
|
925
|
+
")": "₎",
|
926
|
+
},
|
927
|
+
}.freeze
|
928
|
+
|
929
|
+
SUP_PARENTHESIS = {
|
930
|
+
open: {
|
931
|
+
"⁽": "⁽",
|
932
|
+
},
|
933
|
+
close: {
|
934
|
+
"⁾": "⁾",
|
935
|
+
},
|
936
|
+
}.freeze
|
937
|
+
|
938
|
+
MATRIXS = {
|
939
|
+
pmatrix: "⒨",
|
940
|
+
vmatrix: "⒱",
|
941
|
+
Vmatrix: "⒩",
|
942
|
+
bmatrix: "ⓢ",
|
943
|
+
Bmatrix: "Ⓢ",
|
944
|
+
eqarray: "█",
|
945
|
+
matrix: "■",
|
946
|
+
cases: "Ⓒ",
|
947
|
+
}.freeze
|
948
|
+
|
949
|
+
COMBINING_SYMBOLS = {
|
950
|
+
"!!": "‼",
|
951
|
+
"-+": "∓",
|
952
|
+
"+-": "±",
|
953
|
+
}.freeze
|
954
|
+
|
955
|
+
UNICODE_FRACTIONS = {
|
956
|
+
"⅓": [1, 3],
|
957
|
+
"⅔": [2, 3],
|
958
|
+
"⅕": [1, 5],
|
959
|
+
"⅖": [2, 5],
|
960
|
+
"⅗": [3, 5],
|
961
|
+
"⅘": [4, 5],
|
962
|
+
"⅙": [1, 6],
|
963
|
+
"⅚": [5, 6],
|
964
|
+
"⅐": [1, 7],
|
965
|
+
"⅛": [1, 8],
|
966
|
+
"⅜": [3, 8],
|
967
|
+
"⅝": [5, 8],
|
968
|
+
"⅞": [7, 8],
|
969
|
+
"⅑": [1, 9],
|
970
|
+
"↉": [0, 3],
|
971
|
+
"½": [1, 2],
|
972
|
+
"¼": [1, 4],
|
973
|
+
"¾": [3, 4],
|
974
|
+
}.freeze
|
975
|
+
|
976
|
+
UNICODED_FONTS = {
|
977
|
+
script: {
|
978
|
+
"H": "ℋ"
|
979
|
+
},
|
980
|
+
fraktur: {
|
981
|
+
"H": "ℌ",
|
982
|
+
},
|
983
|
+
double: {
|
984
|
+
"H": "ℍ"
|
985
|
+
},
|
986
|
+
mitBbb: {
|
987
|
+
D: "ⅅ",
|
988
|
+
d: "ⅆ",
|
989
|
+
e: "ⅇ",
|
990
|
+
i: "ⅈ",
|
991
|
+
j: "ⅉ",
|
992
|
+
},
|
993
|
+
}.freeze
|
994
|
+
|
995
|
+
PREFIXED_PRIMES = {
|
996
|
+
pppprime: "⁗",
|
997
|
+
ppprime: "‴",
|
998
|
+
pprime: "″",
|
999
|
+
prime: "′",
|
1000
|
+
}.freeze
|
1001
|
+
|
1002
|
+
PARENTHESIS_MATRICES = {
|
1003
|
+
pmatrix: "(",
|
1004
|
+
vmatrix: "|",
|
1005
|
+
Vmatrix: "norm[",
|
1006
|
+
bmatrix: "[",
|
1007
|
+
Bmatrix: "{",
|
1008
|
+
eqarray: nil,
|
1009
|
+
matrix: nil,
|
1010
|
+
cases: nil,
|
1011
|
+
}.freeze
|
1012
|
+
end
|
1013
|
+
end
|
1014
|
+
end
|