Mathematics
Write mathematical expressions in LaTeX. To enable math rendering on a page, set math: true in its front matter.
Usage
Use the configured delimiters for inline and block equations:
| Delimiters | Use |
|---|---|
\(...\) | Inline math within a sentence. |
\[...\] | A standalone block equation. |
$$...$$ | An alternative block equation. |
Examples
Inline math
Use \( and \) for expressions within a sentence, such as \(a^2 + b^2 = c^2\).
Use `\(` and `\)` for inline math: \(a^2 + b^2 = c^2\).Block math
Use \[ and \], or $$, for standalone equations.
\[
E = mc^2
\]The $$ delimiters are also supported:
$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
$$Configuration
Math rendering is enabled on a page with the math parameter:
---
params:
math: true
---The site-wide default is disabled, so enable math in the front matter of each page that contains equations. Set it to true globally to enable math on every page, or set it to false on individual pages to override the global setting.
# Enable mathematical rendering on every page (unless you set the `math` parameter to `false` in front matter)
math = false # false (default) or true
mathEngine = "KaTeX" # "KaTeX" (default) or "MathJax"You can choose either KaTeX or MathJax by setting mathEngine to "KaTeX" or "MathJax".
The Goldmark passthrough extension preserves the delimiters configured in config/_default/markup.toml.
Learn more
KaTeX
Fast, browser-based rendering for TeX and LaTeX mathematics.
MathJax
Accessible, browser-based rendering for TeX and MathML mathematics.
Mathematics in Markdown
Hugo guide to rendering LaTeX expressions and equations with MathJax or KaTeX.