KaTeX vs MathJax (v38)

Revision 38 of this benchmark created by Sam on


Preparation HTML

<link href="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.2.0/katex.min.css" rel="stylesheet" type="text/css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.2.0/katex.min.js"></script>
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?delayStartupUntil=configured"></script>

<script>
MathJax.Hub.Config({
  jax: ["input/TeX", "output/HTML-CSS"],
  extensions: [],
  TeX: {
    extensions: ["AMSmath.js", "AMSsymbols.js", "noErrors.js", "noUndefined.js"]
  },
  "HTML-CSS": {
    showMathMenu: false,
  },
  messageStyle: "none"
});
MathJax.Hub.Configured();
</script>

<div id="math"></div>

Setup

var math = document.getElementById("math");
  var formula = "\\dfrac{-b \\pm \\sqrt{b^2 - 4ac}}{2a} S( q) = \int_a^b L(t, q(t), q'(t))\, {d}t";

Teardown



            math.innerHTML = "";
        
  

Test runner

Ready to run.

Testing in
TestOps/sec
KaTeX
// async test
katex.render(formula, math);
math.outerWidth;
deferred.resolve();
ready
MathJax
// async test
math.innerHTML = "<script type='math/tex'>" + formula + "</script>";
MathJax.Hub.Queue(["Process", MathJax.Hub, math]);
MathJax.Hub.Queue(function() {
  math.outerWidth;
  deferred.resolve();
});
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.