Skip to content

Commit 860af3e

Browse files
committed
Move MathJax macros to a separate file
1 parent 361c077 commit 860af3e

File tree

2 files changed

+53
-51
lines changed

2 files changed

+53
-51
lines changed

astro.config.mjs

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ import remarkMath from 'remark-math'
99
import rehypeMathjax from 'rehype-mathjax/chtml'
1010
import expressiveCode from 'astro-expressive-code'
1111
import { expressiveCodeOptions } from './src/site.config'
12+
import { mathJaxMacros } from './src/mathjax.macros'
1213
import icon from 'astro-icon'
1314

1415
// https://astro.build/config
1516
export default defineConfig({
1617
site: 'https://agustinus.kristia.de',
18+
prefetch: true,
1719
redirects: {
1820
'/about': '/'
1921
},
@@ -43,55 +45,7 @@ export default defineConfig({
4345
fontURL: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/output/chtml/fonts/woff-v2'
4446
},
4547
tex: {
46-
macros: {
47-
qed: ['\\tag*{$\\square$}'],
48-
R: ['\\mathbb{R}'],
49-
dint: ['\\mathrm{d}'],
50-
vphi: ['\\boldsymbol{\\phi}'],
51-
vpi: ['\\boldsymbol{\\pi}'],
52-
vpsi: ['\\boldsymbol{\\psi}'],
53-
vomg: ['\\boldsymbol{\\omega}'],
54-
vsigma: ['\\boldsymbol{\\sigma}'],
55-
vzeta: ['\\boldsymbol{\\zeta}'],
56-
vx: ['\\mathbf{x}'],
57-
vy: ['\\mathbf{y}'],
58-
vz: ['\\mathbf{z}'],
59-
vh: ['\\mathbf{h}'],
60-
b: ['\\mathbf'],
61-
vec: ['\\mathrm{vec}'],
62-
vecemph: ['\\mathrm{vec}'],
63-
mvn: ['\\mathcal{MN}'],
64-
G: ['\\mathcal{G}'],
65-
M: ['\\mathcal{M}'],
66-
N: ['\\mathcal{N}'],
67-
S: ['\\mathcal{S}'],
68-
I: ['\\mathcal{I}'],
69-
diag: ['\\mathrm{diag}(#1)', 1],
70-
diagemph: ['\\mathrm{diag}(#1)', 1],
71-
tr: ['\\mathrm{tr}(#1)', 1],
72-
C: ['\\mathbb{C}'],
73-
E: ['\\mathbb{E}'],
74-
D: ['\\mathcal{D}'],
75-
inner: ['\\langle #1 \\rangle', 1],
76-
innerbig: ['\\left \\langle #1 \\right \\rangle', 1],
77-
abs: ['\\lvert #1 \\rvert', 1],
78-
norm: ['\\lVert #1 \\rVert', 1],
79-
two: ['\\mathrm{II}'],
80-
GL: ['\\mathrm{GL}'],
81-
Id: ['\\mathrm{Id}'],
82-
grad: ['\\mathrm{grad} \\, #1', 1],
83-
gradat: ['\\mathrm{grad} \\, #1 \\, \\vert_{#2}', 2],
84-
Hess: ['\\mathrm{Hess} \\, #1', 1],
85-
T: ['\\mathrm{T}'],
86-
dim: ['\\mathrm{dim} \\, #1', 1],
87-
partder: ['\\frac{\\partial #1}{\\partial #2}', 2],
88-
rank: ['\\mathrm{rank} \\, #1', 1],
89-
inv: ['-1'],
90-
map: ['\\mathrm{MAP}'],
91-
L: ['\\mathcal{L}'],
92-
argmax: ['\\operatorname{arg,max}'],
93-
argmin: ['\\operatorname{arg,min}']
94-
}
48+
macros: mathJaxMacros
9549
}
9650
}
9751
]
@@ -101,6 +55,5 @@ export default defineConfig({
10155
className: ['']
10256
}
10357
}
104-
},
105-
prefetch: true
58+
}
10659
})

src/mathjax.macros.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
export const mathJaxMacros = {
2+
qed: ['\\tag*{$\\square$}'],
3+
R: ['\\mathbb{R}'],
4+
dint: ['\\mathrm{d}'],
5+
vphi: ['\\boldsymbol{\\phi}'],
6+
vpi: ['\\boldsymbol{\\pi}'],
7+
vpsi: ['\\boldsymbol{\\psi}'],
8+
vomg: ['\\boldsymbol{\\omega}'],
9+
vsigma: ['\\boldsymbol{\\sigma}'],
10+
vzeta: ['\\boldsymbol{\\zeta}'],
11+
vx: ['\\mathbf{x}'],
12+
vy: ['\\mathbf{y}'],
13+
vz: ['\\mathbf{z}'],
14+
vh: ['\\mathbf{h}'],
15+
b: ['\\mathbf'],
16+
vec: ['\\mathrm{vec}'],
17+
vecemph: ['\\mathrm{vec}'],
18+
mvn: ['\\mathcal{MN}'],
19+
G: ['\\mathcal{G}'],
20+
M: ['\\mathcal{M}'],
21+
N: ['\\mathcal{N}'],
22+
S: ['\\mathcal{S}'],
23+
I: ['\\mathcal{I}'],
24+
diag: ['\\mathrm{diag}(#1)', 1],
25+
diagemph: ['\\mathrm{diag}(#1)', 1],
26+
tr: ['\\mathrm{tr}(#1)', 1],
27+
C: ['\\mathbb{C}'],
28+
E: ['\\mathbb{E}'],
29+
D: ['\\mathcal{D}'],
30+
inner: ['\\langle #1 \\rangle', 1],
31+
innerbig: ['\\left \\langle #1 \\right \\rangle', 1],
32+
abs: ['\\lvert #1 \\rvert', 1],
33+
norm: ['\\lVert #1 \\rVert', 1],
34+
two: ['\\mathrm{II}'],
35+
GL: ['\\mathrm{GL}'],
36+
Id: ['\\mathrm{Id}'],
37+
grad: ['\\mathrm{grad} \\, #1', 1],
38+
gradat: ['\\mathrm{grad} \\, #1 \\, \\vert_{#2}', 2],
39+
Hess: ['\\mathrm{Hess} \\, #1', 1],
40+
T: ['\\mathrm{T}'],
41+
dim: ['\\mathrm{dim} \\, #1', 1],
42+
partder: ['\\frac{\\partial #1}{\\partial #2}', 2],
43+
rank: ['\\mathrm{rank} \\, #1', 1],
44+
inv: ['-1'],
45+
map: ['\\mathrm{MAP}'],
46+
L: ['\\mathcal{L}'],
47+
argmax: ['\\operatorname{arg,max}'],
48+
argmin: ['\\operatorname{arg,min}']
49+
}

0 commit comments

Comments
 (0)