KaTeX is a JavaScript library to render mathematic expressions in your web browser. Similar to MathJax it is able to use TeX as input.
The following command installs katex via npm.
npm install --save katex
.
`-- katex@0.9.0-alpha2
`-- match-at@0.1.1
Here a minimal example of a mathematical expression with KaTeX. Mostly the same as with LaTeX, we just need to escape the backslashes.
fonts
directory
of KaTeX into your path_to_css
directory.<link href="path_to_css/katex.min.css" rel="stylesheet">
<script src="path_to_js/katex.min.js"></script>
<div id="katex-container"></div>
<script>
var katexContainer = document.getElementById('katex-container');
katex.render(
"VAR(Q) = \\frac{1}{n}\\sum \\limits_{i=1}^{n} (q_i - \\mu)^2",
katexContainer
);
</script>
Just replace path_to_css
and path_to_js
with the
real path to the resources. The code from above results in the following
output of the variance formular.