3 min read

KaTeX Math Support

Table of Contents

Mathematical Notation with KaTeX

This blog now supports beautiful mathematical notation using KaTeX! You can write both inline and block math expressions.

πŸ’‘

KaTeX renders math notation quickly and produces high-quality typesetting that looks great in both light and dark themes.


Inline Math

You can include math inline like this: E=mc2E = mc^2 or x=βˆ’bΒ±b2βˆ’4ac2ax = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}.

The area of a circle is A=Ο€r2A = \pi r^2 where rr is the radius.


Block Math

For larger expressions, use block math:

βˆ«βˆ’βˆžβˆžeβˆ’x2dx=Ο€\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}

The SchrΓΆdinger equation:

iβ„βˆ‚βˆ‚tΞ¨(r,t)=H^Ξ¨(r,t)i\hbar \frac{\partial}{\partial t} \Psi(\mathbf{r}, t) = \hat{H} \Psi(\mathbf{r}, t)

Matrices and Arrays

(abcd)(xy)=(ax+bycx+dy)\begin{pmatrix} a & b \\ c & d \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} ax + by \\ cx + dy \end{pmatrix}

Summations and Products

The sum of the first nn natural numbers:

βˆ‘i=1ni=n(n+1)2\sum_{i=1}^{n} i = \frac{n(n+1)}{2}

The factorial function:

n!=∏i=1nin! = \prod_{i=1}^{n} i

Fractions and Roots

Complex fractions:

11+11+11+β‹±\frac{1}{1 + \frac{1}{1 + \frac{1}{1 + \ddots}}}

Nested radicals:

2+2+2+β‹―=2\sqrt{2 + \sqrt{2 + \sqrt{2 + \cdots}}} = 2

Greek Letters and Symbols

Some commonly used mathematical symbols:

  • Alpha: Ξ±\alpha, Beta: Ξ²\beta, Gamma: Ξ³\gamma, Delta: Ξ΄\delta
  • Infinity: ∞\infty, Partial derivative: βˆ‚\partial
  • Therefore: ∴\therefore, Because: ∡\because
  • Approximately: β‰ˆ\approx, Not equal: β‰ \neq

Calculus Examples

The fundamental theorem of calculus:

∫abfβ€²(x) dx=f(b)βˆ’f(a)\int_a^b f'(x) \, dx = f(b) - f(a)

L’HΓ΄pital’s rule for indeterminate forms:

lim⁑xβ†’cf(x)g(x)=lim⁑xβ†’cfβ€²(x)gβ€²(x)\lim_{x \to c} \frac{f(x)}{g(x)} = \lim_{x \to c} \frac{f'(x)}{g'(x)}

Statistics and Probability

The normal distribution:

f(x)=1Οƒ2Ο€eβˆ’12(xβˆ’ΞΌΟƒ)2f(x) = \frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2}

Bayes’ theorem:

P(A∣B)=P(B∣A)β‹…P(A)P(B)P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B)}

Linear Algebra

Eigenvalue equation:

Av=Ξ»vA\mathbf{v} = \lambda\mathbf{v}

The determinant of a 2Γ—2 matrix:

det⁑(abcd)=adβˆ’bc\det\begin{pmatrix} a & b \\ c & d \end{pmatrix} = ad - bc

Usage Instructions

To use math in your own posts:

  1. Inline math: Wrap expressions with single dollar signs: $your_math_here$
  2. Block math: Wrap expressions with double dollar signs:
    $$
    your_math_here
    $$

The KaTeX syntax is largely compatible with LaTeX math mode. For a complete reference, visit the KaTeX documentation.