Login |  Password

Examples: a few mathematical expressions in LaTeX/TeX

In the following, you'll find many useful TeX/LaTeX code snippets for mathematical expressions. These have been taken from an online cookbook.

Inline and paragraph modes:

$x=\frac{1+y}{1+2z^2}$ $ x=\frac{1+y}{1+2z^2} $
$$x=\frac{1+y}{1+2z^2}$$
$$x=\frac{1+y}{1+2z^2}$$

$\int_0^\infty e^{-x^2}dx=

\frac{\sqrt{\pi}}{2}$

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

$$\int_0^\infty e^{-x^2} dx=

\frac{\sqrt{\pi}}{2}$$

$$\int_0^\infty e^{-x^2} dx=\frac{\sqrt{\pi}}{2}$$
$\displaystyle \int_0^\infty e^{-x^2} dx$ $ \displaystyle \int_0^\infty e^{-x^2} dx $

$$\frac{1}{\displaystyle 1+

\frac{1}{\displaystyle 2+

\frac{1}{\displaystyle 3+x}}}+

\frac{1}{1+\frac{1}{2+\frac{1}{3+x}}}$$

$$<br />
			\frac{1}{\displaystyle 1+<br />
			\frac{1}{\displaystyle 2+<br />
			\frac{1}{\displaystyle 3+x}}} +<br />
			\frac{1}{1+\frac{1}{2+\frac{1}{3+x}}}<br />
			$$


Spaces and text in mathematical expressions:

$\sqrt{2} \sin x$, $\sqrt{2}\,\sin x$

$ \sqrt{2} \sin x $, $ \sqrt{2}\,\sin x $

$\int \!\! \int f(x,y)\,

\mathrm{d}x\mathrm{d}y$

$ \int \!\! \int f(x,y)\,\mathrm{d}x\mathrm{d}y $

$$ \mathop{\int \!\!\! \int}_{\mathbf{x} \in \mathbf{R}^2}
\! \langle \mathbf{x},\mathbf{y}\rangle \,d\mathbf{x}$$

$$\mathop{\int \!\!\! \int}_{\mathbf{x} \in \mathbf{R}^2}<br />
			\! \langle \mathbf{x},\mathbf{y}\rangle \,d\mathbf{x}$$
$$ x_1 = a+b \mbox{ and } x_2=a-b $$
$$ x_1 = a+b \mbox{ and } x_2=a-b $$
$$ x_1 = a+b ~~\mbox{and}~~ x_2=a-b $$
$$ x_1 = a+b ~~\mbox{and}~~ x_2=a-b $$

Accents, over/under-line/brace etc.:

$\left] 0,1 \right[ + \lceil x \rfloor -

\langle x,y\rangle$

$ \left] 0,1 \right[ + \lceil x \rfloor - \langle x,y\rangle $

$${n+1\choose k} = {n\choose k} +

{n \choose k-1}$$

$${n+1\choose k} = {n\choose k} + {n \choose k-1}$$

$$\underbrace{n(n-1)(n-2)\dots(n-m+

1)}_{\mbox{total of $m$factors}}$$

$$\underbrace{n(n-1)(n-2)\dots(n-m+1)}_{\mbox{total of $m$factors}}$$

$\hat{x}$, $\check{x}$, $\tilde{a}$,

$\bar{\ell}$, $\dot{y}$, $\ddot{y}$,

$\vec{z_1}$, $\vec{z}_1$

$ \hat{x} $, $ \check{x} $, $ \tilde{a} $, $ \bar{\ell} $, $ \dot{y} $, $ \ddot{y} $, $ \vec{z_1} $, $ \vec{z}_1 $

$\hat{T} = \widehat{T}$,$\bar{T} =\overline{T}$, $\widetilde{xyz}$, $\overbrace{a+\underbrace{b+c}+d}$

$ \hat{T} = \widehat{T} $,$ \bar{T} = \overline{T} $, $ \widetilde{xyz} $,$ \overbrace{a+\underbrace{b+c}+d} $

$$\overline{\overline{a}^2+

\underline{xy}+

\overline{\overline{z}}}$$

$$\overline{\overline{a}^2+\underline{xy}+\overline{\overline{z}}}$$

$$\underbrace{a+\overbrace{b+

\cdots}^{{}=t}+z}_{\mathrm{total}} ~~a+{\overbrace{b+\cdots}}^{126}

+z$$

$$\underbrace{a+\overbrace{b+\cdots}^{{}=t}+z}_{\mathrm{total}} ~~a+{\overbrace{b+\cdots}}^{126}+z$$