KaTeX is the fastest math typesetting library for the web, this module integrates KaTeX with Hugo.
Module |
---|
github.com/hugomods/katex |
hugo.yaml
1module:
2 imports:
3 - path: github.com/hugomods/katex
hugo.toml
1[module]
2[[module.imports]]
3 path = 'github.com/hugomods/katex'
hugo.json
1{
2 "module": {
3 "imports": [
4 {
5 "path": "github.com/hugomods/katex"
6 }
7 ]
8 }
9}
Please skip this step if your theme supports HugoPress.
1{{ partial "katex/assets/css" . }}
Please skip this step if your theme supports HugoPress.
1{{ partial "katex/assets/js" . }}
1```katex
2FORMULA HERE
3```
Parameter | Position | Type | Required | Default | Description |
---|---|---|---|---|---|
formula | #0 | string | - | - | The formula, required when using inline shortcode. |
inline | #1 | boolean | - | false | Whether display inline. |
Inline shortcode
1{{< katex [formula] [inline] />}}
Or use closing shortcode
1{{< katex >}}
2FORMULA HERE
3{{< /katex >}}
1Inline formulas: {{< katex formula="a^n" inline=true />}}, {{< katex "a^2+b^2=c^2" true />}}.
Inline formulas: \(a^n\) , \(a^2+b^2=c^2\) .
1{{< katex >}}
2\begin{array}{l}
3E*{o 1}=\frac{1}{2}\left( { target }*{o 1}- { out }_{o 1}\right)^{2}=\frac{1}{2}(0.01-0.75136507)^{2}=0.274811083 \\
4E_{o 2}=0.023560026 \\
5E*{ {total }}=E*{o 1}+E\_{o 2}=0.274811083+0.023560026=0.298371109
6\end{array}
7{{< /katex >}}