2024-02-05 17:02:49 -06:00
|
|
|
window.renderKatex = (elem=document.body) => {
|
2024-02-05 18:32:08 -06:00
|
|
|
var maths = document.querySelectorAll('.arithmatex'),
|
|
|
|
tex;
|
|
|
|
for (var i = 0; i < maths.length; i++) {
|
|
|
|
tex = maths[i].textContent || maths[i].innerText;
|
|
|
|
if (tex.startsWith('\\(') && tex.endsWith('\\)')) {
|
2024-02-05 19:21:17 -06:00
|
|
|
katex.render(tex.slice(2, -2), maths[i], {
|
|
|
|
'displayMode': false,
|
|
|
|
'throwOnError': false,
|
|
|
|
'strict': false,
|
|
|
|
});
|
2024-02-05 18:32:08 -06:00
|
|
|
} else if (tex.startsWith('\\[') && tex.endsWith('\\]')) {
|
2024-02-05 19:21:17 -06:00
|
|
|
katex.render(tex.slice(2, -2), maths[i], {
|
|
|
|
'displayMode': true,
|
|
|
|
'throwOnError': false,
|
|
|
|
'strict': false,
|
|
|
|
});
|
2024-02-05 18:32:08 -06:00
|
|
|
}
|
|
|
|
}
|
2024-02-05 17:02:49 -06:00
|
|
|
}
|