ein freies Lehrmittel auf der Basis von eduskript

Math

Mathematical notation rendered with KaTeX. Fast, beautiful, supports nearly all standard LaTeX commands.


Inline and block

Inline math: wrap with single $.

The area of a circle is $A = \pi r^2$.

The area of a circle is A=πr2A = \pi r^2.

Block math: wrap with double $$.

$$
E = mc^2
$$
E=mc2E = mc^2

Block math is centered and gets its own paragraph. Inline math flows with the surrounding text.


Common syntax

Fractions

$\frac{a}{b}$
$\frac{x+1}{x-1}$
$\dfrac{1}{2}$  → display-style (always large)
$\tfrac{1}{2}$  → text-style (always small)

ab\frac{a}{b}, x+1x1\frac{x+1}{x-1}, 12\dfrac{1}{2}, 12\tfrac{1}{2}

Exponents and subscripts

$x^2$            → x squared
$x_i$            → x subscript i
$x_i^2$          → both
$x^{2n+1}$       → multi-character exponent (use braces)

x2x^2, xix_i, xi2x_i^2, x2n+1x^{2n+1}

Roots

$\sqrt{x}$
$\sqrt[3]{x}$
$\sqrt[n]{x+y}$

x\sqrt{x}, x3\sqrt[3]{x}, x+yn\sqrt[n]{x+y}

Greek letters

$\alpha, \beta, \gamma, \delta, \epsilon$
$\pi, \sigma, \theta, \omega$
$\Gamma, \Delta, \Pi, \Sigma, \Omega$  → uppercase

α,β,γ,δ,ϵ,π,σ,θ,ω\alpha, \beta, \gamma, \delta, \epsilon, \pi, \sigma, \theta, \omega

Sums, products, integrals

$\sum_{i=1}^{n} x_i$
$\prod_{i=1}^{n} x_i$
$\int_0^1 x^2 \, dx$
$\iint_D f(x,y) \, dx \, dy$
$\lim_{x \to \infty} f(x)$

i=1nxi\sum_{i=1}^{n} x_i, i=1nxi\prod_{i=1}^{n} x_i, 01x2dx\int_0^1 x^2 \, dx, limxf(x)\lim_{x \to \infty} f(x)

Matrices

$$
\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}
$$

(abcd)\begin{pmatrix} a & b \\ c & d \end{pmatrix}

Matrix variants: pmatrix (parens), bmatrix (brackets), Bmatrix (braces), vmatrix (single bars), Vmatrix (double bars).

Aligned equations

$$
\begin{aligned}
x + y &= 10 \\
x - y &= 4 \\
2x &= 14 \\
x &= 7
\end{aligned}
$$

x+y=10xy=42x=14x=7\begin{aligned} x + y &= 10 \\ x - y &= 4 \\ 2x &= 14 \\ x &= 7 \end{aligned}

The & aligns the equations; in this case, all on the equals sign.

Cases

$$
f(x) = \begin{cases}
  x^2 & \text{if } x \geq 0 \\
  -x^2 & \text{if } x < 0
\end{cases}
$$

f(x)={x2if x0x2if x<0f(x) = \begin{cases} x^2 & \text{if } x \geq 0 \\ -x^2 & \text{if } x < 0 \end{cases}

Common operators

$\sin x, \cos x, \tan x, \log x, \ln x, \exp x$
$\min, \max, \arg, \det, \dim$
$x \cdot y, x \times y, x \div y$
$x \leq y, x \geq y, x \neq y, x \approx y, x \equiv y$
$x \in A, A \subset B, A \cup B, A \cap B$
$\forall x, \exists y, \nexists z$
$\to, \rightarrow, \Rightarrow, \mapsto$

Theme-aware colors in math

KaTeX's \textcolor command supports Eduskript's named color palette — every color has a separate light-mode and dark-mode value, picked for legibility on both backgrounds.

$$\textcolor{cyan}{x}^{\textcolor{lightgreen}{n}} + \textcolor{orange}{y}^{\textcolor{lightgreen}{n}} = \textcolor{red}{z}^{\textcolor{lightgreen}{n}}$$

xn+yn=zn\textcolor{cyan}{x}^{\textcolor{lightgreen}{n}} + \textcolor{orange}{y}^{\textcolor{lightgreen}{n}} = \textcolor{red}{z}^{\textcolor{lightgreen}{n}}

Toggle the page theme — every color stays clearly readable.

Available palette colors: cyan, lightgreen, green, orange, red, blue, violet, purple, lightblue, pink, yellow, white, black, gray.

You can also use raw hex values (\textcolor{#ff0000}{x}), but those won't theme-adapt.


Text inside math

Use \text{...} for words inside a math expression:

$P(\text{heads}) = 0.5$
$\text{velocity} = \frac{\text{distance}}{\text{time}}$

P(heads)=0.5P(\text{heads}) = 0.5, velocity=distancetime\text{velocity} = \frac{\text{distance}}{\text{time}}


Spacing tweaks

LaTeX usually picks correct spacing, but sometimes you want to nudge it:

CommandSpacing
\,small space
\;medium space
\quadlarge space
\qquadextra large space
\!negative small space

Useful for differentials in integrals: \int x^2 \, dx.


When KaTeX limits matter

KaTeX renders fast (synchronous, no async load) but supports a subset of LaTeX. Most teaching content fits within the supported subset. Things that don't work:

  • Custom packages (e.g. \usepackage{tikz} — KaTeX has no preamble system)
  • Some less-common environments (gather* for example — use aligned or gathered)
  • Custom macros defined in the source (define them upstream if you need them)

Full supported-commands list: katex.org/docs/supported.


Math cheat sheet

GoalSyntax
Inline math$x = y$
Block math$$x = y$$
Fraction\frac{num}{den}
Exponentx^2, x^{n+1}
Subscriptx_i, x_{ij}
Greek letter\alpha, \Sigma
Square root\sqrt{x}
Sum\sum_{i=1}^{n}
Integral\int_a^b
Matrix\begin{pmatrix} a & b \\ c & d \end{pmatrix}
Aligned equations\begin{aligned} ... \\ ... \end{aligned}
Cases\begin{cases} ... \\ ... \end{cases}
Text in math\text{word}
Themed color\textcolor{cyan}{x}
Small space\,