Mathematical Expressions

Crypto Michael

To enable clear communication of mathematical expressions, GitSite supports LaTeX formatted math within Markdown. For more information, see LaTeX/Mathematics in Wikibooks.

GitSite's math rendering capability uses Katex: an open source, JavaScript-based display engine.

Writing inline expressions

You can surround the expression with dollar symbols $.

This sentence uses `$` delimiters to show math inline:  $\sqrt{3x-1}+(1+x)^2$.

This sentence uses $ delimiters to show math inline: 3x1+(1+x)2\sqrt{3x-1}+(1+x)^2.

Writing expressions as blocks

To add a math expression as a block, add expression inside a fenced code block with the math identifier.

```math
\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
```

You can set the alignment to center or right. For example, use align=center to set alignment to center:

```math align=center
\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
```

You can still use GitHub-styled math expression block by start a new line and delimit the expression with two dollar symbols $$, but you cannot set alignment by this way (always display in center):

$$
\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
$$

(k=1nakbk)2(k=1nak2)(k=1nbk2) \left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)

Tip

Use the visual editor provided by Wiris can help you write math expressions much easier.

Writing chemical equations

The Katex also supports chemical equations by the mhchem extension.

Chemical equation example: $\ce{CO2 + C -> 2 CO}$.

Chemical equation example: COX2+C2CO\ce{CO2 + C -> 2 CO}.

A complex chemical equation as a block:

```math
\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}
```

Share to: