2023-04-24 16:18:54 +02:00
|
|
|
window.addEventListener("load", () => {
|
|
|
|
const macros = {};
|
|
|
|
for (const item of new Map(
|
|
|
|
Object.entries({
|
|
|
|
N: "mathbb{N}",
|
|
|
|
R: "mathbb{R}",
|
|
|
|
Z: "mathbb{Z}",
|
|
|
|
O: "Theta",
|
|
|
|
ra: "rightarrow",
|
|
|
|
la: "leftarrow",
|
|
|
|
RA: "Rightarrow",
|
|
|
|
LA: "Leftarrow",
|
2023-12-10 19:26:20 +01:00
|
|
|
u: "mu",
|
2023-04-24 16:18:54 +02:00
|
|
|
})
|
|
|
|
)[Symbol.iterator]()) {
|
|
|
|
macros[`\\${item[0]}`] = `\\${item[1]}`;
|
|
|
|
}
|
|
|
|
|
2024-03-31 18:05:31 +02:00
|
|
|
const attribute = "data-math-style";
|
2024-03-31 20:34:12 +02:00
|
|
|
for (const element of document.querySelectorAll(`span[${attribute}]`)) {
|
2024-03-31 18:05:31 +02:00
|
|
|
katex.render(element.textContent, element, {
|
|
|
|
throwOnError: false,
|
|
|
|
displayMode: element.getAttribute(attribute) === "display",
|
|
|
|
macros,
|
|
|
|
output: "mathml",
|
|
|
|
});
|
|
|
|
}
|
2023-04-24 16:18:54 +02:00
|
|
|
});
|