Skip to Content

KaTeX Math

Enable with latex: true in nextra(). Nextra handles remark-math and rehype-katex internally.

Inline Math

Use single $ delimiters: The quadratic formula is x=b±b24ac2ax = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}.

Euler’s identity: eiπ+1=0e^{i\pi} + 1 = 0

Block Math

Use double $$ for display math:

ex2dx=π\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi} E=ρε0\nabla \cdot \mathbf{E} = \frac{\rho}{\varepsilon_0}
$$ \int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi} $$ $$ \nabla \cdot \mathbf{E} = \frac{\rho}{\varepsilon_0} $$

Matrix

A=(a11a12a21a22)\mathbf{A} = \begin{pmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix}
$$ \mathbf{A} = \begin{pmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix} $$

Aligned Equations

x˙=σ(yx)y˙=x(ρz)yz˙=xyβz\begin{aligned} \dot{x} &= \sigma(y - x) \\ \dot{y} &= x(\rho - z) - y \\ \dot{z} &= xy - \beta z \end{aligned}
$$ \begin{aligned} \dot{x} &= \sigma(y - x) \\ \dot{y} &= x(\rho - z) - y \\ \dot{z} &= xy - \beta z \end{aligned} $$

Math Fence Block

Use a ```math ``` code fence as an alternative to $$:

f(x)=1σ2πe(xμ)22σ2f(x) = \frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{(x-\mu)^2}{2\sigma^2}}
Was this page helpful?