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

46 lines
1.4 KiB
Markdown
Executable File

---
title: Mathematical notation
date: 2019-03-08
description: A brief sample of mathematical notation in Congo.
tags: ["sample", "katex", "maths", "shortcodes"]
---
KaTeX can be used to render mathematical notation within articles.
<!--more-->
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 two shortcodes: [`katexblock` and `katexinline`]({{< ref "docs/shortcodes#katex" >}}).
Any KaTeX syntax inside either shortcode will be automatically rendered.
Use the online reference of [supported TeX functions](https://katex.org/docs/supported.html) for the available syntax.
## Inline notation
Inline notation can be generated by wrapping the expression in the `katexinline` shortcode.
**Example:**
```tex
% KaTeX inline notation
Inline notation: {{</* katexinline */>}}\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…{{</* /katexinline */>}}
```
Inline notation: {{< katexinline >}}\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…{{< /katexinline >}}
## Block notation
Alternatively, block notation can be generated using the `katexblock` shortcode. This will output the expression in its own HTML block.
**Example:**
```tex
% KaTeX block notation
{{</* katexblock */>}}
\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }
{{</* /katexblock */>}}
```
{{< katexblock >}}
\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }
{{< /katexblock >}}