Mathematical Notation

Jake G May 05, 2021 Updated: January 01, 2022 #Features #Components #Mathematics

You can use KaTeX to render mathematical notation.

Abridge automatically detects the katex component in rendered page or section content and loads the KaTeX files only where they are needed.

If you prefer raw $...$ and $$...$$ delimiters, enable the KaTeX auto-render extension with math_auto_render = true. This setting also enables the required KaTeX files.

You are better off using the component rather than the raw $...$ and $$...$$ delimiters because of Markdown processing in Zola. If you look at the examples toward the bottom of the page, notice that the raw-delimiter version ends up with extra commas that do not appear when the same formula is rendered using the component.

Component Math: Automatic

Using the katex component is enough to enable KaTeX for that page or section. Pages without a KaTeX component do not load the KaTeX CSS or JavaScript.

Auto Render

Raw math delimiters are intentionally opt-in because ordinary prose can contain dollar signs. Enable auto-render globally in zola.toml, or in the front matter of a page/section where raw delimiters are used:

[extra]
math_auto_render = true

The legacy math = true setting is still recognized for compatibility, but is no longer required for component-based math.

Usage

Wrap any valid $\KaTeX$ syntax with $...$ for inline Mathematics and $$...$$ for block Mathematics.

Inline Mathematics

This is the most beautiful equation I've ever seen:

Usage

{% <katex block={false}> %} e^{i\pi}+1=0 {% </katex> %}

Output


<script type="math/tex"> e^{i\pi}+1=0 </script>

Block Mathematics

Some Mathematics in display mode is fair enough:

Usage

{% <katex block={true}> %} \int_0^1 x^2 dx {% </katex> %}

Output


<script type="math/tex;mode=display"> \int_0^1 x^2 dx </script>

Usage

{% <katex block={true}> %} f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi {% </katex> %}

Output


<script type="math/tex;mode=display"> f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi </script>

Auto Render Inline

$ e^{i\pi}+1=0 $

$ e^{i\pi}+1=0 $

Auto Render Block

$$
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
$$

$$ f(x) = \int_{-\infty}^\infty\hat f(\xi),e^{2 \pi i \xi x},d\xi $$