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() { document.addEventListener("DOMContentLoaded", function() {
var macros = { var macros = {
",": (context) => context.future()?.text === " " ? "{\\char`,}" : "\\char`,", ",": (context) => context.future()?.text === " " ? "{\\char`,}" : "\\char`,",
"\\qty": "{#1\\,\\mathrm{#2}}", "\\qty": "{#1\\,\\mathrm{#2}}",
@@ -8,16 +9,16 @@ document.addEventListener("DOMContentLoaded", function() {
"\\cubed": "{^{3}}", "\\cubed": "{^{3}}",
"\\per": "/", "\\per": "/",
"\\percent": "\\%", "\\percent": "\\%",
"\\tera": "T", "\\tera": "\\text{T}",
"\\giga": "G", "\\giga": "\\text{G}",
"\\mega": "M", "\\mega": "\\text{M}",
"\\kilo": "k", "\\kilo": "\\text{k}",
"\\dezi": "d", "\\dezi": "\\text{d}",
"\\centi": "c", "\\centi": "\\text{c}",
"\\milli": "m", "\\milli": "\\text{m}",
"\\micro": "\\text{μ}", "\\micro": "\\text{μ}",
"\\nano": "n", "\\nano": "\\text{n}",
"\\pico": "p", "\\pico": "\\text{p}",
"\\kilogram": "\\text{kg}", "\\kilogram": "\\text{kg}",
"\\meter": "\\text{m}", "\\meter": "\\text{m}",
"\\second": "\\text{s}", "\\second": "\\text{s}",
@@ -46,15 +47,17 @@ document.addEventListener("DOMContentLoaded", function() {
"\\weber": "\\text{Wb}", "\\weber": "\\text{Wb}",
"\\tesla": "\\text{T}", "\\tesla": "\\text{T}",
}; };
renderMathInElement(document.body, { 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, throwOnError : false,
macros: macros macros: macros
}); });
renderMathInElement(document.body, {
delimiters: [{left: '\\[', right: '\\]', display: false}],
throwOnError : false
});
}); });
function shuffleChildren(el) { function shuffleChildren(el) {