CoCalc Blog

Is KaTeX ready for Prime Time? You be the judge.

Hal Snyder • • latex

CoCalc now offers an option to render LaTeX using KaTeX rather than MathJax. At the moment, KaTeX is an experimental feature which is turned off by default. To enable it, open Account / Preferences, and under Other Settings, check the box next to “KaTeX: render using KaTeX when possible, instead of MathJax”.


enabling KaTeX in Account Preferences

KaTeX is often over 100 times faster than MathJax, but it doesn’t handle all expressions covered by MathJax (or LaTeX). In these cases, CoCalc with KaTeX enabled will still fall back to MathJax. The selection happens for individual expressions, so one expression in a markdown file or a notebook cell might be rendered with KaTeX, while another would be rendered with MathJax.

Choosing KaTeX only impacts how you see math when interacting with CoCalc; it has no impact on collaborators or students working with you, or on the content of documents you create.

For more about what KaTeX doesn’t handle, see for example this discussion of limitations in the array environment. Also, KaTeX doesn’t support \mbox, but \text is fine.

To see whether a formula is displayed with KaTeX or MathJax, right-click on the rendered formula. If MathJax was used, you will get a dialog pop-up starting with “Show Math As”.


right-click showing MathJax dialog

If KaTeX was used, you will get a generic dialog pop-up, details depending on your browser, not about math.

Note: KaTeX rendering is not enabled in Sage worksheets at this time.

Why not give KaTeX a try? We’d love to know your experiences with it. Let us know by emailing [email protected]. Based on your feedback and further testing, we intend to make KaTeX the default soon!