Math and Markdown

Mathematics banner

This standalone article (not part of any series) shows off inline and block math alongside highlighted code. ✨

Inline and display math

Euler's identity is beautiful: $e^{i\pi} + 1 = 0$.

The Gaussian integral, as a display equation:

$$\int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi}$$

Some code

import math

def gaussian(x, mu=0.0, sigma=1.0):
    coeff = 1.0 / (sigma * math.sqrt(2 * math.pi))
    return coeff * math.exp(-((x - mu) ** 2) / (2 * sigma ** 2))

Math and code, side by side.

Wrap expressions in the katex component[1] so Markdown doesn't escape the backslashes before KaTeX runs.

  1. The component emits the raw expression into a span that the KaTeX auto-render script processes in the browser.