LaTeX in Jekyll

less than 1 minute read

How I added support for Katex

The head loads the KaTeX javascript/css.

/_includes/head/custom.html:


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.9.0-alpha2/katex.min.css" integrity="sha384-exe4Ak6B0EoJI0ogGxjJ8rn+RN3ftPnEQrGwX59KTCl5ybGzvHGKjhPKk/KC3abb" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.9.0-alpha2/katex.min.js" integrity="sha384-OMvkZ24ANLwviZR2lVq8ujbE/bUO8IR1FdBrKLQBI14Gq5Xp/lksIccGkmKL8m+h" crossorigin="anonymous"></script>

The footer calls /assets/js/katex_render.js which renders the LaTeX.

/_includes/footer/custom.html:


<script src="/assets/js/katex_render.js"></script>

Now, thanks to I can render pretty math in the browser


Thanks to Type Theme for the inspiration/code.

Tags:

Updated: