Skip to main content
v2026.11,858 entries · CC-BY 4.0

Integration in LaTeX: \int Syntax, Limits and Set Notation

How to write integration in LaTeX: \int limits, multiple integrals with amsmath, integrals in text, set notation and common errors.

Written and maintained by CASRAI Editorial Board

Last updated

Short answer: in LaTeX, integration is written with the \int command inside math mode, with the limits attached as a subscript and a superscript: \int_{a}^{b} x^2 \,dx typesets the definite integral of x² from a to b. Load the amsmath package in the preamble to get the multiple-integral commands (\iint, \iiint). This page covers single, multiple and cyclic integrals, how to put an integral in running text, why the limits move between inline and display math, and how to write set notation such as { x ∈ ℝ | x > 0 }.

Who this is for: researchers and analysts writing equations in a manuscript, thesis or report who need correct, copy-ready syntax and an explanation of why a given line misbehaves.

What it is used for in research

Integrals appear wherever a manuscript defines a continuous quantity: expected values and probability densities in statistics, work and flux in physics, area under a curve in a methods section, and normalising constants in a model description. LaTeX typesets them in math mode, a separate mode with its own spacing rules, so the same characters typed in ordinary text will not produce an integral sign. Set notation (membership, union, intersection, subset) is written in the same mode and is covered below, because the searches for the two topics overlap.

Install or access (official source only)

Integrals need a working LaTeX distribution or an online LaTeX editor; nothing has to be installed for the basic \int command itself. For the multiple-integral commands, add the AMS maths package to the preamble:

\usepackage{amsmath}

The package is distributed through CTAN; its CTAN page lists amsmath version 2.17z, dated 2025-07-09, released under the LaTeX Project Public Licence 1.3c and maintained by the LaTeX Project Team, with the manual in amsldoc.pdf (page read 2026-11-07). Cyclic integrals additionally need the esint package according to Overleaf’s documentation. Overleaf and the standard TeX distributions bundle these packages, so in most setups a \usepackage line is all that is required. If you are new to the online editor, see what Overleaf is.

Step-by-step: how to write integration in LaTeX

How do you add integrals?

  1. Put the document in math mode. For an integral inside a sentence use \( ... \) or $ ... $. For a displayed, unnumbered equation use \[ ... \]. For a numbered equation use the equation environment, or equation* (from amsmath) for an unnumbered one.
  2. Type \int followed by the lower limit as a subscript and the upper limit as a superscript, each in braces: \int_{a}^{b}.
  3. Type the integrand, then a thin space \, and the differential: \int_{a}^{b} x^2 \,dx. Overleaf’s own example uses exactly this form; the \, keeps the dx from touching the integrand.
  4. Compile. The same source renders differently inline and in display mode (see below), which is expected behaviour, not an error.

A minimal complete document, following the pattern in Overleaf’s Integrals, sums and limits article:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
Inline: \( \int_{a}^{b} x^2 \,dx \).

Display:
\[ \int_{a}^{b} x^2 \,dx \]
\end{document}

How do you write an integral in text?

Wrap it in inline math delimiters, $\int_{0}^{1} f(x)\,dx$ or \(\int_{0}^{1} f(x)\,dx\), inside the sentence. Overleaf’s Mathematical expressions article lists three inline forms: \( ... \), $ ... $ and \begin{math} ... \end{math}. Inline integrals are set compactly so they do not push the lines apart; if you need the larger display look in the middle of a sentence, see the \displaystyle note below.

Multiple and cyclic integrals

The variants below are the commands Overleaf documents for double, triple and higher integrals. Each takes limits the same way as \int.

Command What it typesets Package noted by Overleaf
\int Single integral Available in base LaTeX math mode
\iint Double integral amsmath
\iiint Triple integral amsmath
\iiiint Quadruple integral amsmath
\idotsint Integral signs with dots between (n-fold integral) amsmath
\oint Cyclic (contour) integral Overleaf: amsmath and esint for cyclic integrals

Sums, products and limits follow the same subscript/superscript pattern: \sum_{i=1}^{n}, \prod_{i=1}^{n} and \lim_{x \to \infty} f(x). For the limit command in depth, see LaTeX lim syntax and limits under or beside the operator. To put several integrals on separate lines, Overleaf’s article uses the gather* environment from amsmath; for line breaks inside one equation see a new line in a LaTeX equation.

Output and how to read it

Why the limits move between inline and display

In display math the limits of \int are placed above and below the integral sign’s ends; inline they are set as small side scripts to save vertical space. That is the style change Overleaf describes under its display-style article: math mode has four styles (\textstyle, \displaystyle, \scriptstyle, \scriptscriptstyle), and the placement of limits changes with the style. Forcing \displaystyle inside running text enlarges the formula, but Overleaf warns that it “does impact heavily on the line spacing”, so reserve it for the cases where legibility of a limit matters more than even leading.

If you want to control limit position yourself, standard TeX provides \limits and \nolimits after the operator: \int\limits_{a}^{b} forces the limits above and below, \int\nolimits_{a}^{b} forces them to the side. These two commands are not documented on the Overleaf pages cited here; they come from standard TeX math typesetting, so test the result in your own document class.

How do you write set notation in LaTeX?

Set notation uses ordinary math-mode symbols. Curly braces must be escaped, because bare { } only group characters:

$A = \{ x \in \mathbb{R} \mid x > 0 \}$

This produces A = { x ∈ ℝ | x > 0 }. The pieces: \{ and \} print literal braces; \in is the membership relation; \mid is the “such that” bar; \mathbb{R} is the blackboard-bold letter, which requires the amssymb (or amsfonts) package. Overleaf’s Mathematical expressions article lists the set operators and relations below. For other uses of the vertical bar, see the vertical line in LaTeX.

Command Meaning Type
\cup Union Binary operator
\cap Intersection Binary operator
\subset Subset Relation
\supset Superset Relation
\subseteq Subset or equal Relation
\supseteq Superset or equal Relation

Greek letters used for integration variables and parameters are covered in Greek symbols in LaTeX, and arrays of values in matrices in LaTeX.

Troubleshooting

Symptom Likely cause Fix
“Undefined control sequence” on \iint, \iiint or \idotsint The amsmath package is not loaded Add \usepackage{amsmath} to the preamble
“Undefined control sequence” on a cyclic-integral variant The esint package is not loaded (Overleaf lists amsmath and esint for cyclic integrals) Add \usepackage{esint} after amsmath
“Missing $ inserted” or the integral sign prints nothing useful The command was typed outside math mode Wrap it in $ ... $, \( ... \) or \[ ... \]
The dx collides with the integrand No space before the differential Write \,dx, as in Overleaf’s example
Limits appear beside the sign when you wanted them above and below Inline (text) style is active Use a display environment, \displaystyle, or \limits
Braces in set notation do not print Unescaped { } only group Use \{ and \}
\mathbb is undefined The AMS symbol fonts are not loaded Add \usepackage{amssymb}

Free alternatives (where to write and render LaTeX math)

The syntax above is the same in every LaTeX environment. These are options for producing or displaying it; none is endorsed over another here, and plan terms and prices are deliberately not stated.

Tool What it is
Overleaf Browser-based LaTeX editor with its own documentation library (the source for most commands on this page)
TeX Live A TeX distribution for installing LaTeX locally
MiKTeX A TeX distribution, mainly used on Windows
TeXstudio A desktop editor that works with a local TeX distribution
MathJax and KaTeX JavaScript libraries that render LaTeX-style math on web pages; they cover common math commands but are not full LaTeX, so check unusual commands against their own documentation

FAQ

How to write integration in LaTeX?

Use \int_{lower}^{upper} integrand \,dx in math mode, for example \int_{a}^{b} x^2 \,dx. Load amsmath for multiple integrals.

How do I write set notation in LaTeX?

Use \{ x \in A \mid condition \} in math mode, with \cup, \cap, \subset and \subseteq for operations and relations. Escape the braces.

How do you add integrals?

Type \int with a subscript for the lower limit and a superscript for the upper limit, then the integrand and \,dx. Use \iint or \iiint for double and triple integrals.

How do you write an integral in text?

Place it between $ ... $ or \( ... \) within the sentence. For a standalone equation use \[ ... \].

Sources (official documentation)

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Integration in LaTeX: \int Syntax, Limits and Set Notation

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →