katex math formulas on html
Sección: Diseño web
Creado: 11-10-26
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.js"></script>
<script>
(function(){
$(".math").each(function() {
var texTxt = $(this).text();
el = $(this).get(0);
if(el.tagName == "DIV"){
addDisp = "\\displaystyle ";
} else {
addDisp = "";
}
try {
katex.render(addDisp+texTxt, el);
}
catch(err) {
$(this).html("<span class='err'>"+err);
}
});
})();
</script>