183 lines
4.8 KiB
Markdown
183 lines
4.8 KiB
Markdown
---
|
||
title: "Diagrams and Math Typesetting"
|
||
description: "This cheat sheet provides a quick overview of diagrams and math typesetting."
|
||
summary: "This cheat sheet provides a quick overview of diagrams and math typesetting."
|
||
date: 2023-03-31T13:45:33+02:00
|
||
lastmod: 2023-03-31T13:45:33+02:00
|
||
draft: true
|
||
weight: 50
|
||
images: []
|
||
categories: []
|
||
tags: []
|
||
contributors: ["Henk Verlinde"]
|
||
pinned: false
|
||
homepage: false
|
||
katex: true
|
||
---
|
||
|
||
## GoAT
|
||
|
||
### Example 1
|
||
|
||
````md
|
||
```goat
|
||
. . . .--- 1 .-- 1 / 1
|
||
/ \ | | .---+ .-+ +
|
||
/ \ .---+---. .--+--. | '--- 2 | '-- 2 / \ 2
|
||
+ + | | | | ---+ ---+ +
|
||
/ \ / \ .-+-. .-+-. .+. .+. | .--- 3 | .-- 3 \ / 3
|
||
/ \ / \ | | | | | | | | '---+ '-+ +
|
||
1 2 3 4 1 2 3 4 1 2 3 4 '--- 4 '-- 4 \ 4
|
||
|
||
```
|
||
````
|
||
|
||
```goat
|
||
. . . .--- 1 .-- 1 / 1
|
||
/ \ | | .---+ .-+ +
|
||
/ \ .---+---. .--+--. | '--- 2 | '-- 2 / \ 2
|
||
+ + | | | | ---+ ---+ +
|
||
/ \ / \ .-+-. .-+-. .+. .+. | .--- 3 | .-- 3 \ / 3
|
||
/ \ / \ | | | | | | | | '---+ '-+ +
|
||
1 2 3 4 1 2 3 4 1 2 3 4 '--- 4 '-- 4 \ 4
|
||
|
||
```
|
||
|
||
### Example 2
|
||
|
||
````md
|
||
```goat
|
||
.---. .-. .-. .-. .-.
|
||
| A +----->| 1 +<---->| 2 |<----+ 4 +------------------. | 8 |
|
||
'---' '-' '+' '-' | '-'
|
||
| ^ | ^
|
||
v | v |
|
||
.-. .-+-. .-. .-+-. .-. .+. .---.
|
||
| 3 +---->| B |<----->| 5 +---->| C +---->| 6 +---->| 7 |<---->| D |
|
||
'-' '---' '-' '---' '-' '-' '---'
|
||
```
|
||
````
|
||
|
||
```goat
|
||
.---. .-. .-. .-. .-.
|
||
| A +----->| 1 +<---->| 2 |<----+ 4 +------------------. | 8 |
|
||
'---' '-' '+' '-' | '-'
|
||
| ^ | ^
|
||
v | v |
|
||
.-. .-+-. .-. .-+-. .-. .+. .---.
|
||
| 3 +---->| B |<----->| 5 +---->| C +---->| 6 +---->| 7 |<---->| D |
|
||
'-' '---' '-' '---' '-' '-' '---'
|
||
```
|
||
|
||
## Mermaid
|
||
|
||
### Example 1
|
||
|
||
````md
|
||
```mermaid
|
||
graph TD
|
||
A[Hard] -->|Text| B(Round)
|
||
B --> C{Decision}
|
||
C -->|One| D[Result 1]
|
||
C -->|Two| E[Result 2]
|
||
```
|
||
````
|
||
|
||
Renders into:
|
||
|
||
```mermaid
|
||
graph TD
|
||
A[Hard] -->|Text| B(Round)
|
||
B --> C{Decision}
|
||
C -->|One| D[Result 1]
|
||
C -->|Two| E[Result 2]
|
||
```
|
||
|
||
### Example 2
|
||
|
||
````md
|
||
```mermaid
|
||
sequenceDiagram
|
||
participant Alice
|
||
participant Bob
|
||
Alice->>John: Hello John, how are you?
|
||
loop Healthcheck
|
||
John->>John: Fight against hypochondria
|
||
end
|
||
Note right of John: Rational thoughts <br/>prevail!
|
||
John-->>Alice: Great!
|
||
John->>Bob: How about you?
|
||
Bob-->>John: Jolly good!
|
||
```
|
||
````
|
||
|
||
Renders into:
|
||
|
||
```mermaid
|
||
sequenceDiagram
|
||
participant Alice
|
||
participant Bob
|
||
Alice->>John: Hello John, how are you?
|
||
loop Healthcheck
|
||
John->>John: Fight against hypochondria
|
||
end
|
||
Note right of John: Rational thoughts <br/>prevail!
|
||
John-->>Alice: Great!
|
||
John->>Bob: How about you?
|
||
Bob-->>John: Jolly good!
|
||
```
|
||
|
||
## KaTeX
|
||
|
||
The default display mode delimiters are `$$` or `\\[` and `\\]`.
|
||
|
||
### Example 1
|
||
|
||
```md
|
||
$$\sum_{x=1}^5 y^z$$
|
||
```
|
||
|
||
Renders into:
|
||
|
||
$$\sum_{x=1}^5 y^z$$
|
||
|
||
### Example 2
|
||
|
||
```md
|
||
$$
|
||
\begin{equation*}
|
||
n \sim 10^{18} \mathrm{cm^{-3}} \left(\frac{100\mathrm{km}}{R}\right)^2 \left(\frac{10\mathrm{MeV}}{\langle E \rangle}\right).
|
||
\end{equation*}
|
||
$$
|
||
```
|
||
|
||
Renders into:
|
||
|
||
$$
|
||
\begin{equation*}
|
||
n \sim 10^{18} \mathrm{cm^{-3}} \left(\frac{100\mathrm{km}}{R}\right)^2 \left(\frac{10\mathrm{MeV}}{\langle E \rangle}\right).
|
||
\end{equation*}
|
||
$$
|
||
|
||
### Example 3
|
||
|
||
```md
|
||
\\[\int_a^b f(x)\\]
|
||
```
|
||
|
||
Renders into:
|
||
|
||
\\[\int_a^b f(x)\\]
|
||
|
||
### Example 4
|
||
|
||
Inline mode delimiters are `\\(` and `\\)`.
|
||
|
||
```md
|
||
Mass–energy relation: \\(E = mc^2\\)
|
||
```
|
||
|
||
Renders into:
|
||
|
||
Mass–energy relation: \\(E = mc^2\\)
|