Add multiline LaTeX equation example to wiki

- Ref: https://codeberg.org/forgejo/forgejo/issues/6902
This commit is contained in:
Gusted 2025-02-19 20:57:52 +00:00 committed by Earl Warren
parent 244da92224
commit 758b1825a4

View file

@ -126,3 +126,19 @@ $ \frac{1}{2} = 0.5 $
This will then result in the following properly rendered equation: This will then result in the following properly rendered equation:
![The $\frac{1}{2} = 0.5$ equation properly rendered by KaTeX](../_images/user/wiki/katex_example.png) ![The $\frac{1}{2} = 0.5$ equation properly rendered by KaTeX](../_images/user/wiki/katex_example.png)
It is also possible to have LaTeX render in display mode, using, `$$` or `\[` with `\]`:
```markdown
\[ \mathbf{R} = \frac 1M \iiint_Q \rho(\mathbf{r}) \mathbf{r} \mathrm dV \]
$$ (p \implies q) \iff (\neg q \implies \neg p) $$
```
It is however not possible to use this when the equation spans multiple lines, in that case codeblock with the language `math` should be used, for example:
````markdown
```math
\int_0^\pi\ln(1-2\alpha\cos x+\alpha^2) \mathrm dx =
2\pi\ln|\alpha|
```
````