-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtex_maths.py
167 lines (159 loc) · 4.1 KB
/
tex_maths.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
from talon import Context, Module
mod = Module()
mod.list("tex_greek_letters", desc="TeX greek letters")
mod.list("tex_symbols", desc="TeX mathematical symbols")
ctx = Context()
symbols = {
# operators
"fraction": "frac",
# "summation": "sum",
# "product": "prod",
# "limit": "lim",
"[square] root": "sqrt",
"generic root": "root",
"integral": "int",
"double integral": "iint",
"triple integral": "iiint",
"times": "times",
"divide": "div",
"C dot": "cdot",
"plus or minus": "pm",
"partial": "partial",
"infinity": "infty",
"(nice frack | nice fraction)": "nicefrac",
"binomial": "binom",
"vector nabla": "nabla",
# accents
"accent hat": "hat",
"accent tilde": "tilde",
"accent dot": "dot",
"accent double dot": "ddot",
# "accent bar": "bar",
"accent vector": "vec",
# trig
"sine": "sin",
"cosine": "cos",
"tangent": "tan",
"secant": "sec",
"cosecant": "csc",
"cotangent": "cot",
"arc sine": "arcsin",
"arc cosine": "arccos",
"arc tan": "arctan",
"hyperbolic sine": "sinh",
"hyperbolic cosine": "cosh",
"hyperbolic cotangent": "coth",
"hyperbolic tangent": "tanh",
# functions
# "argument": "arg",
"maximum": "max",
"minimum": "min",
"modulus": "bmod",
"infimum": "inf",
"supremum": "sup",
# relations
"there exists": "exists",
"member [of]": "in",
"not in": "notin",
"for all": "forall",
"[is] not equal [to]": "neq",
"greater or equal": "geq",
"less or equal": "leq",
"[is] approximately [equal] [to]": "approx",
"proportional [to]": "propto",
"preference less [than]": "prec",
"preference less equals": "preceq",
"preference greater [than]": "succ",
"preference greater equal": "succeq",
# logic
"mark and": "land",
"mark or": "lor",
"mark not": "lnot",
#
"left arrow": "leftarrow",
"right arrow": "rightarrow",
"up arrow": "uparrow",
"down arrow": "downarrow",
"left right arrow": "leftrightarrow",
"maps to": "mapsto",
"oh plus": "oplus",
"oh times": "otimes",
"big oh plus": "bigoplus",
"big oh times": "bigotimes",
#
"dot dot dot": "dots",
"diagonal dots": "ddots",
"horizontal dots": "cdots",
"vertical dots": "vdots",
# sets
"empty set": "emptyset",
"subset": "subseteq",
"superset": "supset",
"strict subset": "subsetneq",
"strict superset": "supsetneq",
"intersection": "cap",
"union": "cup",
"GCD": "gcd",
"cat hom": "hom",
"kernel": "ker",
"unit": "unitone",
"unit two": "unittwo",
"unit fraction": "unitfrac",
"text fraction": "tfrac",
"display fraction": "dfrac",
"continued fraction": "cfrac",
"continued fraction (left)": "cfracleft",
"continued fraction (right)": "cfracright",
"text binomial": "tbinom",
"display binomial": "dbinom",
# my additions
"long right arrow": "longrightarrow",
# denote magnitude of vectors
"mag": "Vert",
"low dots": "ldots",
"square root": "sqrt",
"equivalent": "leftrightarrow",
"medium space": ":",
"proper subset": "subset",
"stop": "cdot",
"member": "in",
"normal tech": "textrm",
"long equivalent": "longleftrightarrow",
"overline": "overline",
"restriction": "restriction",
# "minus set": "setminus",
"circle": "circ",
"diamond": "diamond",
"congruent": "equiv",
"sat minus":"setminus"
}
greek_letters = {
"alpha": "alpha",
"beater": "beta",
"gamma": "gamma",
"delta": "delta",
"epsilon": "varepsilon",
"zita": "zeta",
"eater": "eta",
"theta": "theta",
"iota": "iota",
"kappa": "kappa",
"lambda": "lambda",
"mu": "mu",
"new": "nu",
"zee": "xi",
"pie": "pi",
"row": "rho",
"sigma": "sigma",
"tau": "tau",
# "oopsilon": "upsilon",
"phi": "phi",
"chi": "chi",
"sigh": "psi",
"omega": "omega",
}
ctx.lists["user.tex_symbols"] = symbols
ctx.lists["user.tex_greek_letters"] = {
**greek_letters,
**{f"big {k}": v.title() for k, v in greek_letters.items()},
}