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.

∫abf(x) dx∫0∞e−x2 dx=π2\int_a^b f(x) \, dx \qquad \int_0^{\infty} e^{-x^2} \, dx = \frac{\sqrt{\pi}}{2}

Open this formula in the editor

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.

∫abf(x) dx\int\limits_a^b f(x) \, dx

Open this formula in the editor

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.

∬Df(x,y) dx dy∭Vρ dV∮CF⋅dr\iint_D f(x,y) \, dx \, dy \qquad \iiint_V \rho \, dV \qquad \oint_C \mathbf{F} \cdot d\mathbf{r}

Open this formula in the editor

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.

∫01x2 dx=x33∣01=13\int_0^1 x^2 \, dx = \left. \frac{x^3}{3} \right|_0^1 = \frac{1}{3}

Open this formula in the editor

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
\]
Result
The compiled example

Open in the editor

Pitfalls

Compiled with pdfLaTeX from TeX Live 2023.

Related pages