Math (KaTeX)

Mathematical equations and formulas rendered with KaTeX


Math (KaTeX)

Render mathematical equations using LaTeX syntax, powered by KaTeX for fast client-side rendering.

Inline Math

The Pythagorean theorem states that $a^2 + b^2 = c^2$ for right triangles.

Einstein's mass-energy equivalence: $E = mc^2$.

Syntax:

Inline equation: $a^2 + b^2 = c^2$
Markdown

Block Equations

$$ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} $$

Syntax:

$$
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
$$
Markdown

Common Examples

Integrals:

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

Summation:

$$ \sum_{i=1}^{n} i = \frac{n(n+1)}{2} $$

Matrices:

$$ \begin{pmatrix} a & b \\ c & d \end{pmatrix} \times \begin{pmatrix} e \\ f \end{pmatrix} = \begin{pmatrix} ae + bf \\ ce + df \end{pmatrix} $$

Limits:

$$ \lim_{x \to \infty} \frac{1}{x} = 0 $$

Derivatives:

$$ \frac{d}{dx} \left( x^n \right) = nx^{n-1} $$

Best Practices

  • Use inline math $...$ for short expressions within text
  • Use block math $$...$$ for important equations that deserve their own line
  • Test complex equations to ensure they render correctly
  • KaTeX supports most standard LaTeX math commands