congo/exampleSite/content/samples/mathematical-notation/index.md

1.6 KiB
Executable File

title date description tags
Mathematical notation 2019-03-08 A brief sample of mathematical notation in Congo.
sample
katex
maths
shortcodes

KaTeX can be used to render mathematical notation within articles.

Congo will only bundle the KaTeX assets into your project if you make use of mathematical notation. In order for this to work, congo provides a shortcode [katex]({{< ref "docs/shortcodes#katex" >}}) than can be used with either katex block or katex inline. Any KaTeX syntax inside the shortcode will be automatically rendered.

Use the online reference of supported TeX functions for the available syntax.

Inline notation

Inline notation can be generated by wrapping the expression in the katex inline or katex shortcode.

Example:

% KaTeX inline notation
Inline notation: {{</* katex inline */>}}\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…{{</* /katex */>}}
Shorthand version: {{</* katex */>}}\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…{{</* /katex */>}}

Inline notation: {{< katex inline >}}\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…{{< /katex >}}

Shorthand version: {{< katex >}}\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…{{< /katex >}}

Block notation

Alternatively, block notation can be generated using the block parameter. This will output the expression in its own HTML block.

Example:

% KaTeX block notation
{{</* katex block */>}}
 \varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }
{{</* /katex */>}}

{{< katex block >}} \varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } } {{< /katex >}}