refactor: update katex settings

This commit is contained in:
Matthias Jung
2026-01-06 22:20:59 +04:00
parent a13b206f1d
commit 60010525c5
+17 -14
View File
@@ -1,4 +1,5 @@
document.addEventListener("DOMContentLoaded", function() {
var macros = {
",": (context) => context.future()?.text === " " ? "{\\char`,}" : "\\char`,",
"\\qty": "{#1\\,\\mathrm{#2}}",
@@ -8,16 +9,16 @@ document.addEventListener("DOMContentLoaded", function() {
"\\cubed": "{^{3}}",
"\\per": "/",
"\\percent": "\\%",
"\\tera": "T",
"\\giga": "G",
"\\mega": "M",
"\\kilo": "k",
"\\dezi": "d",
"\\centi": "c",
"\\milli": "m",
"\\tera": "\\text{T}",
"\\giga": "\\text{G}",
"\\mega": "\\text{M}",
"\\kilo": "\\text{k}",
"\\dezi": "\\text{d}",
"\\centi": "\\text{c}",
"\\milli": "\\text{m}",
"\\micro": "\\text{μ}",
"\\nano": "n",
"\\pico": "p",
"\\nano": "\\text{n}",
"\\pico": "\\text{p}",
"\\kilogram": "\\text{kg}",
"\\meter": "\\text{m}",
"\\second": "\\text{s}",
@@ -46,15 +47,17 @@ document.addEventListener("DOMContentLoaded", function() {
"\\weber": "\\text{Wb}",
"\\tesla": "\\text{T}",
};
renderMathInElement(document.body, {
delimiters: [{left: '$', right: '$', display: false}],
delimiters: [
{left: '$$', right: '$$', display: true}, // Note: $$ has to come before $
{left: '$', right: '$', display: false},
{left: '\\[', right: '\\]', display: true},
{left: "\\(", right: "\\)", display: false},
],
throwOnError : false,
macros: macros
});
renderMathInElement(document.body, {
delimiters: [{left: '\\[', right: '\\]', display: false}],
throwOnError : false
});
});
function shuffleChildren(el) {