2021-11-03 23:08:59 +00:00
---
title: Mathematical notation
date: 2019-03-08
description: A brief sample of mathematical notation in Congo.
2021-11-03 23:17:27 +00:00
tags: ["sample", "katex", "maths", "shortcodes"]
2021-11-03 23:08:59 +00:00
---
KaTeX can be used to render mathematical notation within articles.
<!-- more -->
2023-08-24 22:55:29 +00:00
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.
2021-11-03 23:08:59 +00:00
Use the online reference of [supported TeX functions ](https://katex.org/docs/supported.html ) for the available syntax.
## Inline notation
2023-08-24 22:55:29 +00:00
Inline notation can be generated by wrapping the expression in the `katex inline` or `katex` shortcode.
2021-11-03 23:08:59 +00:00
**Example:**
```tex
% KaTeX inline notation
2023-08-24 22:55:29 +00:00
Inline notation: {{< /* katex inline */>}}\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…{{</* /katex */>}}
Shorthand version: {{< /* katex */>}}\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…{{</* /katex */>}}
2021-11-03 23:08:59 +00:00
```
2023-08-24 22:55:29 +00:00
Inline notation: {{< katex inline > }}\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…{{< / katex > }}
Shorthand version: {{< katex > }}\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…{{< / katex > }}
2021-11-03 23:08:59 +00:00
## Block notation
2023-08-24 22:55:29 +00:00
Alternatively, block notation can be generated using the `block` parameter. This will output the expression in its own HTML block.
2021-11-03 23:08:59 +00:00
**Example:**
```tex
% KaTeX block notation
2023-08-24 22:55:29 +00:00
{{< /* katex block */>}}
2021-11-03 23:08:59 +00:00
\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }
2023-08-24 22:55:29 +00:00
{{< /* /katex */>}}
2021-11-03 23:08:59 +00:00
```
2023-08-24 22:55:29 +00:00
{{< katex block > }}
2021-11-03 23:08:59 +00:00
\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }
2023-08-24 22:55:29 +00:00
{{< / katex > }}