Skip to content

Commit ddb213b

Browse files
committed
define macros in yaml file
1 parent cab4eee commit ddb213b

3 files changed

Lines changed: 112 additions & 103 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ As a practical guideline, avoid introducing more than four properties (or four c
181181

182182
1. Use `\varnothing` to display the empty set, not `\emptyset`.
183183
2. Write `non-empty`, not `nonempty`. Same for `non-unital`, `non-expansive`, etc.
184-
3. For categories which are referenced multiple times, create a [LaTeX macro](/src/lib/server/macros.ts) for their notation.
184+
3. For LaTeX symbols that are used repeatedly, in particular category-theoretic notation, define a LaTeX macro in [macros.yaml](databases/catdat/data/macros.yaml).
185185

186186
### Responsible Use of AI
187187

databases/catdat/data/macros.yaml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# cspell:disable
2+
3+
# blackboard bold letters
4+
\IN: \mathbb{N}
5+
\IZ: \mathbb{Z}
6+
\IQ: \mathbb{Q}
7+
\IR: \mathbb{R}
8+
\IC: \mathbb{C}
9+
\IF: \mathbb{F}
10+
\IB: \mathbb{B}
11+
\IA: \mathbb{A}
12+
\IP: \mathbb{P}
13+
14+
# calligraphic letters
15+
\A: \mathcal{A}
16+
\B: \mathcal{B}
17+
\C: \mathcal{C}
18+
\D: \mathcal{D}
19+
\E: \mathcal{E}
20+
\F: \mathcal{F}
21+
\I: \mathcal{I}
22+
\J: \mathcal{J}
23+
\O: \mathcal{O}
24+
\S: \mathcal{S}
25+
26+
# abbreviations
27+
\op: \mathrm{op}
28+
\c: \mathrm{c}
29+
\f: \mathrm{f}
30+
\fg: \mathrm{fg}
31+
\fp: \mathrm{fp}
32+
\ab: \mathrm{ab}
33+
\reg: \mathrm{reg}
34+
35+
# operators
36+
\Mor: \operatorname{Mor}
37+
\Hom: \operatorname{Hom}
38+
\End: \operatorname{End}
39+
\Ob: \operatorname{Ob}
40+
\id: \operatorname{id}
41+
\card: \operatorname{card}
42+
\colim: \operatorname{colim}
43+
\im: \operatorname{im}
44+
\lcm: \operatorname{lcm}
45+
\Spec: \operatorname{Spec}
46+
\Sh: \operatorname{Sh}
47+
\ord: \operatorname{ord}
48+
\diag: \operatorname{diag}
49+
\Sub: \operatorname{Sub}
50+
\Quot: \operatorname{Quot}
51+
\supp: \operatorname{supp}
52+
\Coexp: \operatorname{Coexp}
53+
\inc: \operatorname{inc}
54+
55+
# categories
56+
\Set: \mathbf{Set}
57+
\Rel: \mathbf{Rel}
58+
\Ab: \mathbf{Ab}
59+
\Grp: \mathbf{Grp}
60+
\Vect: \mathbf{Vect}
61+
\Ring: \mathbf{Ring}
62+
\Alg: \mathbf{Alg}
63+
\CRing: \mathbf{CRing}
64+
\CAlg: \mathbf{CAlg}
65+
\Rng: \mathbf{Rng}
66+
\Mon: \mathbf{Mon}
67+
\CMon: \mathbf{CMon}
68+
\Mod: \mathbf{Mod}
69+
\Fld: \mathbf{Fld}
70+
\FinAb: \mathbf{FinAb}
71+
\FinGrp: \mathbf{FinGrp}
72+
\FreeAb: \mathbf{FreeAb}
73+
\TorsFreeAb: \mathbf{TorsFreeAb}
74+
\TorsAb: \mathbf{TorsAb}
75+
\Cat: \mathbf{Cat}
76+
\Ban: \mathbf{Ban}
77+
\Meas: \mathbf{Meas}
78+
\Met: \mathbf{Met}
79+
\PMet: \mathbf{PMet}
80+
\Top: \mathbf{Top}
81+
\Haus: \mathbf{Haus}
82+
\sSet: \mathbf{sSet}
83+
\Man: \mathbf{Man}
84+
\LRS: \mathbf{LRS}
85+
\Sch: \mathbf{Sch}
86+
\Pos: \mathbf{Pos}
87+
\Prost: \mathbf{Prost}
88+
\FinOrd: \mathbf{FinOrd}
89+
\FinSet: \mathbf{FinSet}
90+
\FI: \mathbf{FI}
91+
\FS: \mathbf{FS}
92+
\Sp: \mathbf{Sp}
93+
\0: \mathbf{0}
94+
\1: \mathbf{1}
95+
\2: \mathbf{2}
96+
\On: \mathbf{On}
97+
\Idem: \mathbf{Idem}
98+
\Split: \mathbf{Split}
99+
\RS: \mathbf{RS}
100+
\CoAlg: \mathbf{CoAlg}
101+
\Cone: \mathbf{Cone}
102+
\SemiGrp: \mathbf{SemiGrp}

src/lib/server/macros.ts

Lines changed: 9 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,10 @@
1-
// cspell:disable
1+
import YAML from 'yaml'
2+
import path from 'node:path'
3+
import fs from 'node:fs'
24

3-
/**
4-
* Dictionary of LaTeX macros
5-
*/
6-
export const MACROS = {
7-
// blackboard bold letters
8-
'\\IN': '\\mathbb{N}',
9-
'\\IZ': '\\mathbb{Z}',
10-
'\\IQ': '\\mathbb{Q}',
11-
'\\IR': '\\mathbb{R}',
12-
'\\IC': '\\mathbb{C}',
13-
'\\IF': '\\mathbb{F}',
14-
'\\IB': '\\mathbb{B}',
15-
'\\IA': '\\mathbb{A}',
16-
'\\IP': '\\mathbb{P}',
17-
// calligraphic letters
18-
'\\A': '\\mathcal{A}',
19-
'\\B': '\\mathcal{B}',
20-
'\\C': '\\mathcal{C}',
21-
'\\D': '\\mathcal{D}',
22-
'\\E': '\\mathcal{E}',
23-
'\\F': '\\mathcal{F}',
24-
'\\I': '\\mathcal{I}',
25-
'\\J': '\\mathcal{J}',
26-
'\\O': '\\mathcal{O}',
27-
'\\S': '\\mathcal{S}',
28-
// abbreviations
29-
'\\op': '\\mathrm{op}',
30-
'\\c': '\\mathrm{c}',
31-
'\\f': '\\mathrm{f}',
32-
'\\fg': '\\mathrm{fg}',
33-
'\\fp': '\\mathrm{fp}',
34-
'\\ab': '\\mathrm{ab}',
35-
'\\reg': '\\mathrm{reg}',
36-
// operators
37-
'\\Mor': '\\operatorname{Mor}',
38-
'\\Hom': '\\operatorname{Hom}',
39-
'\\End': '\\operatorname{End}',
40-
'\\Ob': '\\operatorname{Ob}',
41-
'\\id': '\\operatorname{id}',
42-
'\\card': '\\operatorname{card}',
43-
'\\colim': '\\operatorname{colim}',
44-
'\\im': '\\operatorname{im}',
45-
'\\lcm': '\\operatorname{lcm}',
46-
'\\Spec': '\\operatorname{Spec}',
47-
'\\Sh': '\\operatorname{Sh}',
48-
'\\ord': '\\operatorname{ord}',
49-
'\\diag': '\\operatorname{diag}',
50-
'\\Sub': '\\operatorname{Sub}',
51-
'\\Quot': '\\operatorname{Quot}',
52-
'\\supp': '\\operatorname{supp}',
53-
'\\Coexp': '\\operatorname{Coexp}',
54-
'\\inc': '\\operatorname{inc}',
55-
// categories
56-
'\\Set': '\\mathbf{Set}',
57-
'\\Rel': '\\mathbf{Rel}',
58-
'\\Ab': '\\mathbf{Ab}',
59-
'\\Grp': '\\mathbf{Grp}',
60-
'\\Vect': '\\mathbf{Vect}',
61-
'\\Ring': '\\mathbf{Ring}',
62-
'\\Alg': '\\mathbf{Alg}',
63-
'\\CRing': '\\mathbf{CRing}',
64-
'\\CAlg': '\\mathbf{CAlg}',
65-
'\\Rng': '\\mathbf{Rng}',
66-
'\\Mon': '\\mathbf{Mon}',
67-
'\\CMon': '\\mathbf{CMon}',
68-
'\\Mod': '\\mathbf{Mod}',
69-
'\\Fld': '\\mathbf{Fld}',
70-
'\\FinAb': '\\mathbf{FinAb}',
71-
'\\FinGrp': '\\mathbf{FinGrp}',
72-
'\\FreeAb': '\\mathbf{FreeAb}',
73-
'\\TorsFreeAb': '\\mathbf{TorsFreeAb}',
74-
'\\TorsAb': '\\mathbf{TorsAb}',
75-
'\\Cat': '\\mathbf{Cat}',
76-
'\\Ban': '\\mathbf{Ban}',
77-
'\\Meas': '\\mathbf{Meas}',
78-
'\\Met': '\\mathbf{Met}',
79-
'\\PMet': '\\mathbf{PMet}',
80-
'\\Top': '\\mathbf{Top}',
81-
'\\Haus': '\\mathbf{Haus}',
82-
'\\sSet': '\\mathbf{sSet}',
83-
'\\Man': '\\mathbf{Man}',
84-
'\\LRS': '\\mathbf{LRS}',
85-
'\\Sch': '\\mathbf{Sch}',
86-
'\\Pos': '\\mathbf{Pos}',
87-
'\\Prost': '\\mathbf{Prost}',
88-
'\\FinOrd': '\\mathbf{FinOrd}',
89-
'\\FinSet': '\\mathbf{FinSet}',
90-
'\\FI': '\\mathbf{FI}',
91-
'\\FS': '\\mathbf{FS}',
92-
'\\Sp': '\\mathbf{Sp}',
93-
'\\0': '\\mathbf{0}',
94-
'\\1': '\\mathbf{1}',
95-
'\\2': '\\mathbf{2}',
96-
'\\On': '\\mathbf{On}',
97-
'\\Idem': '\\mathbf{Idem}',
98-
'\\Split': '\\mathbf{Split}',
99-
'\\RS': '\\mathbf{RS}',
100-
'\\CoAlg': '\\mathbf{CoAlg}',
101-
'\\Cone': '\\mathbf{Cone}',
102-
'\\SemiGrp': '\\mathbf{SemiGrp}',
103-
}
5+
export const MACROS = YAML.parse(
6+
fs.readFileSync(
7+
path.join(process.cwd(), 'databases', 'catdat', 'data', 'macros.yaml'),
8+
'utf8',
9+
),
10+
) as Record<string, string>

0 commit comments

Comments
 (0)