Adam Oudad

Adam Oudad

(Machine) Learning log.

1 minute read

I followed this good tutorial on how to add \(\KaTeX\) to hugo.

Here is an example showing that KaTeX (should) now work. $$\int_{a}^{b} x^2 dx$$

Here are some remarks I have about the original tutorial.

Auto-rendering

Add the following script in the footer

<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0-rc.1/dist/contrib/auto-render.min.js" integrity="sha384-yACMu8JWxKzSp/C1YV86pzGiQ/l1YUfE8oPuahJQxzehAjEt2GiQuy/BIvl9KyeF" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>

This will activate the auto rendering

Other remarks

  • {{ end }} is unnecessary, only write the following to include the katex.html partial.

    {{ partial "katex.html" . }}
  • \(\KaTeX\) actually works also with .org files ! For inline math, you will need to use \( KaTeX \) rather than $$KaTeX$$ or $KaTeX$, which seem not to work yet
  • katex: true is not necessary
comments powered by Disqus

Recent posts

See more

Categories

About

This website is a weblog were I write about computer science, machine learning, language learning.