KaTeX Extension

Rendering math is enabled using KaTeX. The extension adds the ability to create numbered equations as well as reference the equations with traditional shortcut syntax: e.g., [eq-heat].

Table 1: Available configure options for th KatexExtension object.

KeyDefaultDescription
prefixEq.The prefix to used when referring to an equation by the \\label content.

Block Equations

Numbered and non-numbered equations are defined using the \begin{equation} and \end{equation} environment common to LaTeX mathematics, as shown in Example 1.

Example 1: Example of syntax for creating numbered equations with KaTeX.

\begin{equation}
y = a\cdot x + b
\end{equation}

(1)

To include a non-numbered equation, simply use the * version of the environment, as shown in Example 2.

Example 2: Example of syntax for creating non-numbered equations with Katex.

\begin{equation*}
c^2 = a^2 + b^2
\end{equation*}

It is possible to reference numbered block equations. First, the equation must contain a label. A label is added using traditional \label{my-eq} command. Then within the text this label can be used within a shortcut link, e.g. [my-eq] (see Core Extension:Shortcut links).

Example 3 provides a complete example of creating and referencing an equation. The prefix is dictated by the extension prefix configuration option (see Table 1).

Example 3: Example that references a labeled, numbered block equation.

[eq-label] is a famous equation.

\begin{equation}
\label{eq-label}
E = mc^2
\end{equation}

Eq. 2 is a famous equation.

(2)

Inline Equations

Inline equations also use traditional LaTeX syntax, i.e., the content is wrapped in single $ as shown below.

Example 4: Example of an inline LaTeX equation.

This $y=2\phi$ is inline.
This is inline.