Skip to main content
Statistics LibreTexts

LaTeX math markup

Note: this page is a subsection of the Wikipedia page Help:Displaying a formula.

Subscripts, superscripts, integrals

Feature Syntax How it looks rendered
HTML PNG
Superscript a^2 \(a^2\) \(a^2 \,\!\)
Subscript a_2 \(a_2\) \(a_2 \,\!\)
Grouping a^{2+2} \(a^{2+2}\) \(a^{2+2}\,\!\)
a_{i,j} \(a_{i,j}\) \(a_{i,j}\,\!\)
Combining sub & super x_2^3 \(x_2^3\)
Preceding and/or Additional sub & super \sideset{_1^2}{_3^4}\prod_a^b \(\sideset{_1^2}{_3^4}\prod_a^b\)
{}_1^2\!\Omega_3^4 \({}_1^2\!\Omega_3^4\)
Stacking \overset{\alpha}{\omega} \(\overset{\alpha}{\omega}\)
\underset{\alpha}{\omega} \(\underset{\alpha}{\omega}\)
\overset{\alpha}{\underset{\gamma}{\omega}} \(\overset{\alpha}{\underset{\gamma}{\omega}}\)
\stackrel{\alpha}{\omega} \(\stackrel{\alpha}{\omega}\)
Derivative (forced PNG) x', y, f', f\!   \(x', y'', f', f''\!\)
Derivative (f in italics may overlap primes in HTML) x', y, f', f \(x', y'', f', f''\) \(x', y'', f', f''\!\)
Derivative (wrong in HTML) x^\prime, y^{\prime\prime} \(x^\prime, y^{\prime\prime}\) \(x^\prime, y^{\prime\prime}\,\!\)
Derivative (wrong in PNG) x\prime, y\prime\prime \(x\prime, y\prime\prime\) \(x\prime, y\prime\prime\,\!\)
Derivative dots \dot{x}, \ddot{x} \(\dot{x}, \ddot{x}\)
Underlines, overlines, vectors \hat a \ \bar b \ \vec c \(\hat a \ \bar b \ \vec c\)
\overrightarrow{a b} \ \overleftarrow{c d} \ \widehat{d e f} \(\overrightarrow{a b} \ \overleftarrow{c d} \ \widehat{d e f}\)
\overline{g h i} \ \underline{j k l} \(\overline{g h i} \ \underline{j k l}\)
Arrows A \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C \( A \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C\)
Overbraces \overbrace{ 1+2+\cdots+100 }^{5050} \(\overbrace{ 1+2+\cdots+100 }^{5050}\)
Underbraces \underbrace{ a+b+\cdots+z }_{26} \(\underbrace{ a+b+\cdots+z }_{26}\)
Sum \sum_{k=1}^N k^2 \(\sum_{k=1}^N k^2\)
Sum (force \textstyle) \textstyle \sum_{k=1}^N k^2 \(\textstyle \sum_{k=1}^N k^2\)
Product \prod_{i=1}^N x_i \(\prod_{i=1}^N x_i\)
Product (force \textstyle) \textstyle \prod_{i=1}^N x_i \(\textstyle \prod_{i=1}^N x_i\)
Coproduct \coprod_{i=1}^N x_i \(\coprod_{i=1}^N x_i\)
Coproduct (force \textstyle) \textstyle \coprod_{i=1}^N x_i \(\textstyle \coprod_{i=1}^N x_i\)
Limit \lim_{n \to \infty}x_n \(\lim_{n \to \infty}x_n\)
Limit (force \textstyle) \textstyle \lim_{n \to \infty}x_n \(\textstyle \lim_{n \to \infty}x_n\)
Integral \int\limits_{-N}^{N} e^x\, dx \(\int\limits_{-N}^{N} e^x\, dx\)
Integral (force \textstyle) \textstyle \int\limits_{-N}^{N} e^x\, dx \(\textstyle \int\limits_{-N}^{N} e^x\, dx\)
Double integral \iint\limits_{D} \, dx\,dy \(\iint\limits_{D} \, dx\,dy\)
Triple integral \iiint\limits_{E} \, dx\,dy\,dz \(\iiint\limits_{E} \, dx\,dy\,dz\)
Quadruple integral \iiiint\limits_{F} \, dx\,dy\,dz\,dt \(\iiiint\limits_{F} \, dx\,dy\,dz\,dt\)
Path integral \oint\limits_{C} x^3\, dx + 4y^2\, dy \(\oint\limits_{C} x^3\, dx + 4y^2\, dy\)
Intersections \bigcap_1^{n} p \(\bigcap_1^{n} p\)
Unions \bigcup_1^{k} p \(\bigcup_1^{k} p\)

Fractions, matrices, multilines

Feature Syntax How it looks rendered
Fractions \frac{2}{4}=0.5 \(\frac{2}{4}=0.5\)
Small Fractions \tfrac{2}{4} = 0.5 \(\tfrac{2}{4} = 0.5\)
Large (normal) Fractions \dfrac{2}{4} = 0.5 \(\dfrac{2}{4} = 0.5\)
Large (nested) Fractions \cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a \(\cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a\)
Binomial coefficients \binom{n}{k} \(\binom{n}{k}\)
Small Binomial coefficients \tbinom{n}{k} \(\tbinom{n}{k}\)
Large (normal) Binomial coefficients \dbinom{n}{k} \(\dbinom{n}{k}\)
Matrices
\begin{matrix}
  x & y \\
  z & v 
\end{matrix}
\(\begin{matrix} x & y \\ z & v \end{matrix}\)
\begin{vmatrix}
  x & y \\
  z & v 
\end{vmatrix}
\(\begin{vmatrix} x & y \\ z & v \end{vmatrix}\)
\begin{Vmatrix}
  x & y \\
  z & v
\end{Vmatrix}
\(\begin{Vmatrix} x & y \\ z & v \end{Vmatrix}\)
\begin{bmatrix}
  0      & \cdots & 0      \\
  \vdots & \ddots & \vdots \\ 
  0      & \cdots & 0
\end{bmatrix}
\(\begin{bmatrix} 0 & \cdots & 0 \\ \vdots & \ddots & \vdots \\ 0 & \cdots & 0\end{bmatrix} \)
\begin{Bmatrix}
  x & y \\
  z & v
\end{Bmatrix}
\(\begin{Bmatrix} x & y \\ z & v \end{Bmatrix}\)
\begin{pmatrix}
  x & y \\
  z & v 
\end{pmatrix}
\(\begin{pmatrix} x & y \\ z & v \end{pmatrix}\)
\bigl( \begin{smallmatrix}
  a&b\\ c&d
\end{smallmatrix} \bigr)
\( \bigl( \begin{smallmatrix} a&b\\ c&d \end{smallmatrix} \bigr) \)
Case distinctions
f(n) = 
\begin{cases} 
  n/2,  & \mbox{if }n\mbox{ is even} \\
  3n+1, & \mbox{if }n\mbox{ is odd} 
\end{cases}
\(f(n) = \begin{cases} n/2, & \mbox{if }n\mbox{ is even} \\ 3n+1, & \mbox{if }n\mbox{ is odd} \end{cases} \)
Multiline equations
\begin{align}
 f(x) & = (a+b)^2 \\
      & = a^2+2ab+b^2 \\
\end{align}
\( \begin{align} f(x) & = (a+b)^2 \\ & = a^2+2ab+b^2 \\ \end{align} \)
\begin{alignat}{2}
 f(x) & = (a-b)^2 \\
      & = a^2-2ab+b^2 \\
\end{alignat}
\( \begin{alignat}{2} f(x) & = (a-b)^2 \\ & = a^2-2ab+b^2 \\ \end{alignat} \)
Multiline equations (must define number of colums used ({lcr}) (should not be used unless needed)
\begin{array}{lcl}
  z        & = & a \\
  f(x,y,z) & = & x + y + z  
\end{array}
\(\begin{array}{lcl} z & = & a \\ f(x,y,z) & = & x + y + z \end{array}\)
Multiline equations (more)
\begin{array}{lcr}
  z        & = & a \\
  f(x,y,z) & = & x + y + z     
\end{array}
\(\begin{array}{lcr} z & = & a \\ f(x,y,z) & = & x + y + z \end{array}\)
Breaking up a long expression so that it wraps when necessary

<math>f(x) \,\!</math>
<math>= \sum_{n=0}^\infty a_n x^n </math>
<math>= a_0+a_1x+a_2x^2+\cdots</math>

\(f(x) \,\!\)\(= \sum_{n=0}^\infty a_n x^n \)\(= a_0 +a_1x+a_2x^2+\cdots\)

Simultaneous equations
\begin{cases}
    3x + 5y +  z \\
    7x - 2y + 4z \\
   -6x + 3y + 2z 
\end{cases}
\(\begin{cases} 3x + 5y + z \\ 7x - 2y + 4z \\ -6x + 3y + 2z \end{cases}\)