Integrals in LaTeX (int, iint, oint)
\int draws the integral sign, and the limits follow with _ and ^: \int_a^b f(x)\,dx. Double and triple integrals are \iint and \iiint from amsmath; a closed integral is \oint.
Preamble
The snippets on this page need these lines before \begin{document}:
\usepackage{amsmath}Integral with limits
The lower limit follows _, the upper limit follows ^; a limit longer than one character needs braces. \, adds a thin space in front of the differential dx.
\[
\int_a^b f(x) \, dx
\qquad
\int_0^{\infty} e^{-x^2} \, dx = \frac{\sqrt{\pi}}{2}
\]Change the formula
The preview is drawn in your browser by KaTeX, which knows the common math commands. The editor compiles the formula with pdfTeX.
Limits above and below the sign
LaTeX puts integral limits to the right of the sign. \int\limits_a^b sets them above and below instead. To get that for every integral, load amsmath with the option intlimits.
\[
\int\limits_a^b f(x) \, dx
\]Change the formula
The preview is drawn in your browser by KaTeX, which knows the common math commands. The editor compiles the formula with pdfTeX.
Double, triple and closed integrals
\iint and \iiint from amsmath place the signs closer together than several \int in a row. \oint is part of LaTeX.
\[
\iint_D f(x,y) \, dx \, dy
\qquad
\iiint_V \rho \, dV
\qquad
\oint_C \mathbf{F} \cdot d\mathbf{r}
\]Change the formula
The preview is drawn in your browser by KaTeX, which knows the common math commands. The editor compiles the formula with pdfTeX.
Evaluate between two limits
\left. is an invisible bracket that pairs with \right|, so the bar gets the height of the fraction in front of it. The limits are attached to the bar with _ and ^.
\[
\int_0^1 x^2 \, dx = \left. \frac{x^3}{3} \right|_0^1 = \frac{1}{3}
\]Change the formula
The preview is drawn in your browser by KaTeX, which knows the common math commands. The editor compiles the formula with pdfTeX.
Upright d for the differential
ISO 80000-2 and many journals ask for an upright d. Define a command for it once: \mathrm{d} is the upright letter, and \mathop{}\! in front gives it the thin space of an operator, so \, is no longer needed.
\newcommand{\dd}{\mathop{}\!\mathrm{d}}
\[
\int_a^b f(x) \dd x
\]Pitfalls
- In a line of text the integral sign is small.
$\displaystyle\int_a^b$gives the large form, but it pushes the lines apart. \oiintfor a closed surface integral is defined neither by LaTeX nor byamsmath. Theesintpackage provides it.
Compiled with pdfLaTeX from TeX Live 2023.
Related pages
- Package
amsmath - How-to Sums and products in LaTeX
- How-to Derivatives and partial derivatives in LaTeX
- How-to Spacing in math mode in LaTeX
- How-to Large brackets in LaTeX