Examples of TeX formulas
The easiest way to create a formula is to copy from the examples below and edit to suit your needs.
You can also look on the TeX syntax examples on Wikipedia.
Subscript and superscript of a single character
x^2 |
|
x_2 |
|
2^x |
|
x^2y^2 |
|
x_2y_2 |
|
_2F_3 |
|
Subscript and superscript at several levels and of multiple characters
x^{2y} |
|
2^{2^x} |
|
2^{2^{2^x}} |
|
y_{x_2} |
|
y_{x^2} |
|
((x^2)^3)^4 |
|
{({(x^2)}^3)}^4 |
|
Both subscript and superscript
x^2_3 |
|
x_3^2 |
|
x^{31415}_{92}+\pi |
|
P_2^2 |
|
P{}_2^2 |
|
Reserved word \prime
y_1^\prime |
|
y_2^{\prime\prime} |
|
y_3^{\prime\prime\prime} |
|
f'[g(x)]g'(x) |
|
y_1'+y_2'' |
|
y'_1+y''_2 |
|
Reserved word \sqrt, \underline and \overline
\sqrt 2 |
|
\sqrt {x+2} |
|
\underline 4 |
|
\overline {x+y} |
|
\overline x+\overline y |
|
x^{\underline n} |
|
x^{\overline {m+n}} |
|
\sqrt{x^3+\sqrt\alpha} |
|
\root 3 \of 2 |
|
\root n \of {x^n+y^n} |
|
\root n+1 \of a |
|
Fractions
x+y^2\over k+1 |
|
|
{x+y^2\over k}+1 |
|
|
x+{y^2\over k}+1 |
|
|
x+{y^2\over k+1} |
|
|
x+y^{2\over k+1} |
|
|
{a\over b}\over 2 |
|
|
a\over {b\over 2} |
|
|
a/b \over 2 |
|
|
a \over b/2 |
|
|
x\atop y+2 |
|
|
n\choose k |
|
Sum and Integral
\sum_{n=1}^m |
|
|
\int_{- \infty}^{+ \infty} |
|
|
\int\limits_0^1 |
|
|
\sum\nolimits_{n=1}^m |
|
Common Mathematical Functions
\arccos |
\arcsin |
\arctan |
\arg |
\cos |
\cosh |
\cot |
\coth |
\csc |
\deg |
\det |
\dim |
\exp |
\gcd |
\hom |
\inf |
\ker |
\lg |
\lim |
\liminf |
\limsup |
\ln |
\log |
\max |
\min |
\Pr |
\sec |
\sin |
\sinh |
\sup |
\tan |
\tanh |
\sin2\theta=2\sin\theta\cos\theta |
|
O(n\log n\log\log n) |
|
\Pr(X>x)=\exp(-x/\mu) |
|
\max_{1\le n\le m}\log_2P_n |
|
\lim_{x\to 0}{\sin x\over x}=1 |
|
Text Style or Display Style
Standalone and inline formulas are rendered differently. This is clearly visible in the integral in this line: and the standalone integral on the next line.
The rendition can be controlled explicitly using the textstyle attribute: textstyle="Display" (standalone) or textstyle="inline" (inline).
It is also possible to use reserved words in the formula itself:
\textstyle\sum_{n=1}^m |
|
||||
\displaystyle\sum_{n=1}^m |
|
||||
n + \scriptstyle n + \scriptscriptstyle n |
|
Spaces
\quad |
|
\qquad |
double quad |
\, |
thin space (1/6 quad) |
\> |
medium space (2/9 quad) |
\; |
thick space (5/18 quad) |
\! |
negative thin space (-1/6 quad) |
F_n=F_{n-1}+F_{n-2},\qquad n \ge 2. |
|
\int_0^\infty f(x)\,dx |
|
dx\,dy=r\,dr\,d\theta |
|
y\,dx-x\,dy |
|
Ellipses
x_1+\cdots+x_n |
|
x_1=\cdots=x_n=0 |
|
A_1\times\cdots\times A_n |
|
f(x_1, \ldots,x_n) |
|
x_1x_2\ldots x_n |
|
(1-x)(1-x^2)\ldots(1-x^n) |
|
n(n-1)\ldots(1) |
|
(x_1, \ldots, x_n) \cdot (y_1, \ldots, y_n) = x_1 y_1 + \cdots + x_n y_n |
|
Reserved word \phantom
The \phantom reserved word creates an invisible box whose width, height and depth are the same as the formula itself. The \vphantom reserved word creates a box with no width but with the same height and depth as the subformula. The \hphantom reserved word creates a box with the same width as a normal box but with no height or depth. The \mathstrut macro is defined as "\vphantom(".
\sqrt a+\sqrt d+\sqrt y |
|
\sqrt {\mathstrut a} + \sqrt {\mathstrut d} + \sqrt {\mathstrut y} |
|
\sqrt 2+\sqrt\phantom 2 |
|
\sqrt 2+\sqrt{2\vphantom{1\over 2}} |
|
\sqrt{\hphantom{1234}+2} |
|
Greek letters
\alpha |
|
\iota |
|
||
\beta |
|
\kappa |
|
\sigma |
|
\gamma |
|
\lambda |
|
\varsigma |
|
\delta |
|
\mu |
|
\tau |
|
\epsilon |
|
\nu |
|
\upsilon |
|
\varepsilon |
|
\xi |
|
\phi |
|
\zeta |
|
o |
|
\varphi |
|
\eta |
|
\pi |
|
\chi |
|
\theta |
|
\varpi |
|
\psi |
|
\vartheta |
|
\rho |
|
\omega |
|
\Gamma |
|
\Xi |
|
\Phi |
|
\Delta |
|
\Pi |
|
\Psi |
|
\Theta |
|
\Sigma |
|
\Omega |
|
\Lambda |
|
\Upsilon |
|
Complex examples
4\sqrt{x^2-1}=3+3x |
|
|
16(x^2-1)=9+18x+9x^2 |
|
|
{11\choose3}={11!\over8!3!}=165 |
|
|
=\sqrt{(\sqrt5)^2-2\sqrt5\sqrt3+(\sqrt3)^2} |
|
|
n_i={g_i\over e^{(\epsilon_i-\mu)/kT}-1} |
|
|
\approx\prod_i{(n_i+g_i)!\over n_i!(g_i)!} |
|
|
\sum^n_{k_1=0}\sum^{n-k_1}_{k_2=0}\ldots \sum^{n\!-\!\textstyle\sum^{g-1}_{j=1}k_j}_\phantom kw(n-\sum^g_{i=1}k_i,0) |
|
|
10\>000 Å=1\>000nm=1\mu=1\mu m |
|
|
W_{\lambda b}={2\pi hc^2\over\lambda^5(e^{hc/\lambda kT}-1)}\times 10^{-6}[Watt/m^2,\mu m] |
|
|
\lambda_{max}={2898\over T}[\mu m] |
|
|
W_b = \sigma T^4 [Watt/m^2] |
|
|
\alpha_\lambda+\rho_\lambda+\tau_\lambda=1 |
|
|
L_{10m} = {1\over{{U_1\over L_{10m1}} + {U_2\over L_{10m2}} + {U_3\over L_{10m3}} + \ldots}} |
|