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 the KatexExtension object.
Key | Default | Description |
---|---|---|
active | True | Toggle for disabling the extension. This only changes the initial active state, use setActive to control at runtime. |
prefix | Eq. | The prefix to used when referring to an equation by the \\label content. |
macros | None | Macro definitions to apply to equations. |
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.
To include a non-numbered equation, simply exclude the "id" in the command, as shown in Example 2.
It is possible to reference numbered block equations. First, the equation must contain an "id". Then within the text this label can be used within a shortcut link, e.g. [my-eq]
(see Shortcut links).
Equation References
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).
It is possible to reference equations on other pages. If the page containing the referenced equation has a top-level heading then that will be used. The filename of the page is used when no heading exists.
Inline Equations
Inline equations can use traditional LaTeX syntax, i.e., the content is wrapped in single $
or the inline !eq
command, as shown in Example 5.
Macros
It is possible to define macros within extension configuration. This is done using the 'macros' configuration parameter (see Table 1). For example, the main configuration file for contains the following allowing for equation in Example 6 to be defined.
(contrib/moose/modules/doc/config.yml)