This is an evaluation post. Its only job is to show how the math rules in src/utils/markdown.js render to the page, so the KaTeX integration can be reviewed. Delete it when you are done.
Delimiters: inline math is $...$, display math is $$...$$ (single-line or multi-line). Two conventions: no space directly inside the delimiters, and a $ that immediately follows a word character is never treated as an opener. Red text means KaTeX refused to render the formula (see the last sections).
Euler's identity e i π + 1 = 0 e^{i\pi}+1=0 e iπ + 1 = 0 is often called the most beautiful equation in mathematics. A single sentence can carry several formulas: the area of a circle is A = π r 2 A=\pi r^2 A = π r 2 , the slope of y = m x + b y=mx+b y = m x + b is m m m , and the discriminant Δ = b 2 − 4 a c \Delta=b^2-4ac Δ = b 2 − 4 a c decides whether the roots of a x 2 + b x + c = 0 ax^2+bx+c=0 a x 2 + b x + c = 0 are real.
Sub- and superscripts chain: x i ( 2 ) x_i^{(2)} x i ( 2 ) is the second iterate of the i i i -th component, while f − 1 ( g − 1 ( x ) ) f^{-1}(g^{-1}(x)) f − 1 ( g − 1 ( x )) composes inverse functions, and primes work as f ′ = f ′ ′ = f ′ ′ ′ f' = f'' = f''' f ′ = f ′′ = f ′′′ .
Inline big operators tuck their limits in: ∑ i = 1 n i = n ( n + 1 ) 2 \sum_{i=1}^{n} i = \tfrac{n(n+1)}{2} ∑ i = 1 n i = 2 n ( n + 1 ) and lim x → 0 sin x x = 1 \lim_{x\to 0} \frac{\sin x}{x} = 1 lim x → 0 x s i n x = 1 . Force limits above and below with ∑ i = 1 n \sum\limits_{i=1}^{n} i = 1 ∑ n and ∏ k = 0 ∞ \prod\limits_{k=0}^{\infty} k = 0 ∏ ∞ .
Prices stay literal — a 5$ resistor and a 10$ capacitor, or a $5 part and a $10 board: no math mode is entered, because the delimiters here never satisfy the opener rules.
The quadratic formula, single-line block:
x = − b ± b 2 − 4 a c 2 a x = \frac{-b \pm \sqrt{b^2-4ac}}{2a} x = 2 a − b ± b 2 − 4 a c Multi-line blocks continue until a line ending in $$ — Maxwell's equations in differential form:
∇ × B = μ 0 J + μ 0 ϵ 0 ∂ E ∂ t ∇ ⋅ E = ρ ϵ 0 ∇ × E = − ∂ B ∂ t ∇ ⋅ B = 0 \begin{aligned} \nabla \times \mathbf{B} &= \mu_0 \mathbf{J} + \mu_0 \epsilon_0 \frac{\partial \mathbf{E}}{\partial t} \\ \nabla \cdot \mathbf{E} &= \frac{\rho}{\epsilon_0} \\ \nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} \\ \nabla \cdot \mathbf{B} &= 0 \end{aligned} ∇ × B ∇ ⋅ E ∇ × E ∇ ⋅ B = μ 0 J + μ 0 ϵ 0 ∂ t ∂ E = ϵ 0 ρ = − ∂ t ∂ B = 0 align lines up at the & positions — the Lorenz system:
x ′ = σ ( y − x ) y ′ = x ( ρ − z ) − y z ′ = x y − β z \begin{align} x' &= \sigma (y - x) \\ y' &= x (\rho - z) - y \\ z' &= xy - \beta z \end{align} x ′ y ′ z ′ = σ ( y − x ) = x ( ρ − z ) − y = x y − β z And align*:
a 2 + b 2 = c 2 tan θ = b a \begin{align*} a^2 + b^2 &= c^2 \\ \tan\theta &= \frac{b}{a} \end{align*} a 2 + b 2 tan θ = c 2 = a b equation wraps a single formula (it does not get an automatic number in this build — see "Numbering and tags"):
e i π + 1 = 0 \begin{equation} e^{i\pi} + 1 = 0 \end{equation} e iπ + 1 = 0 gathered centers every line:
( x + y + z ) 2 = x 2 + y 2 + z 2 + 2 x y + 2 x z + 2 y z \begin{gathered} (x+y+z)^2 = x^2 + y^2 + z^2 \\ + 2xy + 2xz + 2yz \end{gathered} ( x + y + z ) 2 = x 2 + y 2 + z 2 + 2 x y + 2 x z + 2 y z ( a b c d ) = ( a x + b y c x + d y ) \begin{pmatrix} a & b \\ c & d \end{pmatrix} = \begin{pmatrix} ax + by \\ cx + dy \end{pmatrix} ( a c b d ) = ( a x + b y c x + d y ) Round, square, and vertical bars; cases for piecewise functions:
u = [ 1 0 0 − 1 ] , { a b c d } , P ( t ) = { 0 , t < 0 t , 0 ≤ t ≤ 1 2 − t , 1 < t ≤ 2 0 , t > 2 \mathbf{u} = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}, \qquad \begin{Bmatrix} a & b \\ c & d \end{Bmatrix}, \qquad P(t) = \begin{cases} 0, & t < 0 \\ t, & 0 \le t \le 1 \\ 2 - t, & 1 < t \le 2 \\ 0, & t > 2 \end{cases} u = [ 1 0 0 − 1 ] , { a c b d } , P ( t ) = ⎩ ⎨ ⎧ 0 , t , 2 − t , 0 , t < 0 0 ≤ t ≤ 1 1 < t ≤ 2 t > 2 Inline matrices stay at text scale: ∣ a b c d ∣ = a d − b c \begin{vmatrix} a & b \\ c & d \end{vmatrix} = ad - bc a c b d = a d − b c , cos θ − sin θ sin θ cos θ \begin{smallmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{smallmatrix} c o s θ s i n θ − s i n θ c o s θ , and the Euclidean norm is ∥ x ∥ 2 = x 1 2 + ⋯ + x n 2 \lVert \mathbf{x} \rVert_2 = \sqrt{x_1^2 + \cdots + x_n^2} ∥ x ∥ 2 = x 1 2 + ⋯ + x n 2 .
Big operators and limits permalink Display mode puts limits above and below:
∑ i = 1 n ∏ j = 1 m x i j ∫ 0 ∞ e − x 2 d x = π 2 ∬ D f ( x , y ) d x d y ∮ γ f ( z ) d z ⋃ i = 1 n A i \sum_{i=1}^{n} \prod_{j=1}^{m} x_{ij} \qquad \int_{0}^{\infty} e^{-x^2}\,dx = \frac{\sqrt{\pi}}{2} \qquad \iint_{D} f(x,y)\,dx\,dy \qquad \oint_{\gamma} f(z)\,dz \qquad \bigcup_{i=1}^{n} A_i i = 1 ∑ n j = 1 ∏ m x ij ∫ 0 ∞ e − x 2 d x = 2 π ∬ D f ( x , y ) d x d y ∮ γ f ( z ) d z i = 1 ⋃ n A i Limits that read as limits:
lim x → 0 e x − 1 x = 1 , lim sup n → ∞ a n ≤ lim inf n → ∞ b n , lim n → ∞ ( 1 + 1 n ) n = e \lim_{x\to 0} \frac{e^x - 1}{x} = 1, \qquad \limsup_{n\to\infty} a_n \le \liminf_{n\to\infty} b_n, \qquad \lim_{n\to\infty} \left(1 + \frac{1}{n}\right)^n = e x → 0 lim x e x − 1 = 1 , n → ∞ lim sup a n ≤ n → ∞ lim inf b n , n → ∞ lim ( 1 + n 1 ) n = e Fractions, radicals, continued fractions permalink Nested fractions and indexed roots:
1 1 + 2 3 + 4 5 2 + 2 3 + a b n ∂ f ∂ x ∣ x = 0 \frac{1}{1 + \frac{2}{3 + \frac{4}{5}}} \qquad \sqrt{2} + \sqrt[3]{2} + \sqrt[n]{\frac{a}{b}} \qquad \frac{\partial f}{\partial x} \bigg|_{x=0} 1 + 3 + 5 4 2 1 2 + 3 2 + n b a ∂ x ∂ f x = 0 A continued fraction, the kind of thing that would be painful to lay out by hand:
1 2 + 1 3 + 1 4 + 1 5 \cfrac{1}{2 + \cfrac{1}{3 + \cfrac{1}{4 + \cfrac{1}{5}}}} 2 + 3 + 4 + 5 1 1 1 1 Accents, bars, and brackets permalink θ ^ v ⃗ x ˉ f ~ x y z ^ x y z ~ x ˙ x ¨ \hat{\theta} \qquad \vec{v} \qquad \bar{x} \qquad \tilde{f} \qquad \widehat{xyz} \qquad \widetilde{xyz} \qquad \dot{x} \qquad \ddot{x} θ ^ v x ˉ f ~ x y z x y z x ˙ x ¨ A B ‾ ∑ ‾ a + b + c ⏞ the sum of the terms x ⋅ x ⋅ x ⏟ the cube a = def b lim γ − + \overline{AB} \qquad \underline{\sum} \qquad \overbrace{a + b + c}^{\text{the sum of the terms}} \qquad \underbrace{x \cdot x \cdot x}_{\text{the cube}} \qquad a \stackrel{\text{def}}{=} b \qquad \underset{\gamma}{\lim} \qquad \overset{+}{-} A B ∑ a + b + c the sum of the terms the cube x ⋅ x ⋅ x a = def b γ lim − + x A x x d x L R g x x \mathbf{x} \qquad \bm{A} \qquad \pmb{x} \qquad \mathit{x} \qquad \mathrm{d}x \qquad \mathcal{L} \qquad \mathbb{R} \qquad \mathfrak{g} \qquad \mathsf{x} \qquad \mathtt{x} x A x x d x L R g x x Text inside math: for x ∈ dom ( f ) \text{for } x \in \text{dom}(f) for x ∈ dom ( f ) , bold text \textbf{bold text} bold text , italic text \textit{italic text} italic text , and erf ( x ) \operatorname{erf}(x) erf ( x ) for a roman operator.
Delimiters, sizing, and spacing permalink Auto-sizing delimiters scale to their content; \big through \Bigg do it manually; \left. and \right| size invisible anchors:
( a b ) [ a b c d ] { a b } d d x ∣ x = 0 ( a b ) ( a b ) \left( \frac{a}{b} \right) \qquad \left[ \begin{array}{cc} a & b \\ c & d \end{array} \right] \qquad \left\{ \frac{a}{b} \right\} \qquad \left. \frac{d}{dx} \right|_{x=0} \qquad \bigg( \frac{a}{b} \bigg) \quad \Bigg( \frac{a}{b} \Bigg) ( b a ) [ a c b d ] { b a } d x d x = 0 ( b a ) ( b a ) Custom fraction delimiters with \genfrac, and the binomial coefficient:
[ a b ] ( n k ) = n ! k ! ( n − k ) ! ( n k ) \genfrac{[}{]}{0pt}{}{a}{b} \qquad \binom{n}{k} = \frac{n!}{k!(n-k)!} \qquad {n \choose k} [ b a ] ( k n ) = k ! ( n − k )! n ! ( k n ) Spacing: thin $a\,b$, thick $a\;b$, negative $a\!b$, word $a\quad b$, and double-word $a\qquad b$.
Relations: a ≤ b a \le b a ≤ b , a ≥ b a \ge b a ≥ b , a ≠ b a \ne b a = b , a ≈ b a \approx b a ≈ b , a ≡ b a \equiv b a ≡ b , a ∼ b a \sim b a ∼ b , a ≃ b a \simeq b a ≃ b , a ≅ b a \cong b a ≅ b , a ∝ b a \propto b a ∝ b , a ≪ b a \ll b a ≪ b , a ≫ b a \gg b a ≫ b , a ⩽ b a \leqslant b a ⩽ b .
Operators: a + b a + b a + b , a ± b a \pm b a ± b , a ∓ b a \mp b a ∓ b , a × b a \times b a × b , a ⋅ b a \cdot b a ⋅ b , a ∘ b a \circ b a ∘ b , a ∙ b a \bullet b a ∙ b , a ÷ b a \div b a ÷ b , a m o d b a \bmod b a mod b , a ( m o d b ) a \pmod{b} a ( mod b ) , a ∣ b a \mid b a ∣ b , a ∤ b a \nmid b a ∤ b .
Arrows: a → b a \to b a → b , a ↦ b a \mapsto b a ↦ b , a → b a \rightarrow b a → b , a ⇒ b a \Rightarrow b a ⇒ b , a ⇐ b a \Leftarrow b a ⇐ b , a ⟺ b a \iff b a ⟺ b , a → label b a \xrightarrow{\text{label}} b a label b , a ↪ b a \hookrightarrow b a ↪ b , a ↠ b a \twoheadrightarrow b a ↠ b .
Sets and logic: a ∈ S a \in S a ∈ S , a ∉ S a \notin S a ∈ / S , S ⊂ T S \subset T S ⊂ T , S ⊆ T S \subseteq T S ⊆ T , A ∪ B A \cup B A ∪ B , A ∩ B A \cap B A ∩ B , A ∖ B A \setminus B A ∖ B , ∅ \emptyset ∅ , ∀ x \forall x ∀ x , ∃ y \exists y ∃ y , ∄ z \nexists z ∄ z , ∴ \therefore ∴ , ∵ \because ∵ .
Greek and geometry: α β γ δ ε ζ η θ ϑ ι κ λ μ ν ξ π ρ σ τ υ ϕ φ χ ψ ω \alpha\,\beta\,\gamma\,\delta\,\varepsilon\,\zeta\,\eta\,\theta\,\vartheta\,\iota\,\kappa\,\lambda\,\mu\,\nu\,\xi\,\pi\,\rho\,\sigma\,\tau\,\upsilon\,\phi\,\varphi\,\chi\,\psi\,\omega α β γ δ ε ζ η θ ϑ ι κ λ μ ν ξ π ρ σ τ υ ϕ φ χ ψ ω and capitals Γ Δ Θ Λ Ξ Π Σ Φ Ψ Ω \Gamma\,\Delta\,\Theta\,\Lambda\,\Xi\,\Pi\,\Sigma\,\Phi\,\Psi\,\Omega Γ Δ Θ Λ Ξ Π Σ Φ Ψ Ω , plus ∠ A B C \angle ABC ∠ A B C , △ A B C \triangle ABC △ A B C , a ⊥ b a \perp b a ⊥ b , a ∥ b a \parallel b a ∥ b , ℏ \hbar ℏ , ℓ \ell ℓ , ℜ z \Re z ℜ z , ℑ z \Im z ℑ z , ℵ 0 \aleph_0 ℵ 0 .
Color, boxes, and cancellation permalink x f ( x ) a b a colored box − b ± b 2 − 4 a c 2 a \textcolor{red}{\mathbf{x}} \qquad \textcolor{blue}{f(x)} \qquad \textcolor{#e67e22}{\frac{a}{b}} \qquad \colorbox{yellow}{\text{a colored box}} \qquad \boxed{\frac{-b \pm \sqrt{b^2-4ac}}{2a}} x f ( x ) b a a colored box 2 a − b ± b 2 − 4 a c Cancellation, in three flavors: a + b a \cancel{+} b a + b , x − y x \bcancel{-} y x − y , z ∗ w z \xcancel{*} w z ∗ w .
This KaTeX build does not number equation or align lines automatically, and \label/\eqref are unsupported. Explicit numbering works with \tag:
e = ∑ n = 0 ∞ 1 n ! (2.71828) e = \sum_{n=0}^{\infty} \frac{1}{n!} \tag{2.71828} e = n = 0 ∑ ∞ n ! 1 ( 2.71828 ) \newcommand works, but only inside the formula that defines it — macros do not leak across formulas:
E [ X ] = μ Var ( X ) = E [ ( X − μ ) 2 ] \newcommand{\E}{\mathbb{E}} \qquad \newcommand{\Var}{\operatorname{Var}} \qquad \E[X] = \mu \qquad \Var(X) = \E[(X - \mu)^2] E [ X ] = μ Var ( X ) = E [( X − μ ) 2 ] KaTeX is called with throwOnError: false, so invalid math renders as readable red text at the failure point instead of breaking the build.
Unknown command:
\unknowncommand x \unknowncommand{x} \unknowncommand x Unbalanced fraction:
\frac{1}
The \href command requires the trust option, which this site does not enable:
\href \href{https://example.org}{a link} \href Math does not wrap. This inline formula overflows the column instead of breaking: det ( a 11 a 12 a 13 a 14 a 15 a 21 a 22 a 23 a 24 a 25 a 31 a 32 a 33 a 34 a 35 a 41 a 42 a 43 a 44 a 45 a 51 a 52 a 53 a 54 a 55 ) = ∑ σ ∈ S 5 sgn ( σ ) ∏ i = 1 5 a i , σ ( i ) \det\begin{pmatrix} a_{11} & a_{12} & a_{13} & a_{14} & a_{15} \\ a_{21} & a_{22} & a_{23} & a_{24} & a_{25} \\ a_{31} & a_{32} & a_{33} & a_{34} & a_{35} \\ a_{41} & a_{42} & a_{43} & a_{44} & a_{45} \\ a_{51} & a_{52} & a_{53} & a_{54} & a_{55} \end{pmatrix} = \sum_{\sigma \in S_5} \operatorname{sgn}(\sigma) \prod_{i=1}^{5} a_{i,\sigma(i)} det a 11 a 21 a 31 a 41 a 51 a 12 a 22 a 32 a 42 a 52 a 13 a 23 a 33 a 43 a 53 a 14 a 24 a 34 a 44 a 54 a 15 a 25 a 35 a 45 a 55 = ∑ σ ∈ S 5 sgn ( σ ) ∏ i = 1 5 a i , σ ( i ) No automatic equation numbering: equation and align render without numbers, and \label/\eqref are unsupported — use \tag for explicit numbers. \eqnarray, \multline, \widebar, \cancelto, \html, \href, \includegraphics, and \resizebox are unsupported in this KaTeX build (or disabled by default).Inline math is one line only; a $ pair spanning a newline is literal text.