Math

LaTeX renders at build time with KaTeX, using the same $…$ and $$…$$ syntax Obsidian uses. No plugin, no client-side JavaScript: the deploy ships plain HTML plus a stylesheet.

Inline

Written as The set $\{x \in \mathbb{N} : x < n\}$ has $n$ elements., this renders as:

The set {xN:x<n}\{x \in \mathbb{N} : x < n\} has nn elements.

Display

A $$…$$ block on its own lines becomes a centred display equation:

T(n)=2T ⁣(n2)+Θ(n)=Θ(nlogn)T(n) = 2\,T\!\left(\frac{n}{2}\right) + \Theta(n) = \Theta(n \log n)

Multi-line environments work too:

Pr[X=k]=(nk)pk(1p)nkE[X]=np\begin{aligned} \Pr[X = k] &= \binom{n}{k}\, p^{k} (1-p)^{n-k} \\ \mathbb{E}[X] &= np \end{aligned}

Notes

  • Math parses before emphasis, so the underscores in $a_i + b_j$ stay subscripts instead of turning into italics: ai+bja_i + b_j.
  • Math inside a fenced code block is left alone, so you can document the syntax without it rendering.
  • The KaTeX stylesheet and its fonts ship only to vaults that contain math.
Created · Updated