This blog renders LaTeX math with MathJax. Posts opt in with
math: true in the front matter, and then you can write mathematics inline with the rest
of your prose. This post doubles as a reference: every rendered equation is shown next to
the Markdown that produced it.
Kramdown (the Markdown engine GitHub Pages uses) treats $$...$$ as math. It’s smart about
context: $$ in the middle of a sentence is rendered inline, while $$ in its own
paragraph is rendered as a centered display block. Crucially, kramdown protects what’s
inside from Markdown processing, so subscripts like x_i won’t get mangled into emphasis.
Inline math
You can drop symbols straight into a sentence. Euler’s identity, , is hard to beat; merge sort runs in ; and a masked share might be written as .
Euler's identity, $$e^{i\pi} + 1 = 0$$, is hard to beat; merge sort runs in
$$O(n \log n)$$; and a masked share might be written as $$x = x_1 \oplus x_2$$.
Display equations
Put the math in its own paragraph to center it. Average memory access time:
$$
\text{AMAT} = t_{\text{hit}} + r_{\text{miss}} \times t_{\text{penalty}}
$$
Fractions, roots, sums, and integrals
The softmax used in a classifier’s output layer:
The continuous Fourier transform:
A classic limit and a root for good measure:
Aligned, multi-step derivations
Use \begin{aligned} to line equations up on the &. Closed form of a geometric series,
the kind that shows up in amortized analysis:
$$
\begin{aligned}
S &= \sum_{k=0}^{n-1} a r^k \\
&= a \, \frac{1 - r^n}{1 - r}, \qquad r \neq 1
\end{aligned}
$$
Matrices and vectors
A matrix and a matrix-vector product:
Piecewise definitions
The cases environment is perfect for recurrences. Factorial, written recursively:
Symbols, Greek, and operators
A quick sampler of the things you’ll reach for most:
That’s the whole toolkit. Anything LaTeX’s math mode can express, MathJax will render here.
To use it in your own post, add math: true to the front matter and write away.