Set Builder in LaTeX (\{ x \mid P(x) \})

{x∣P(x)}\{ x \mid P(x) \}
LaTeX command
\{ x \mid P(x) \}
Package
No package needed: built into LaTeX
Mode
Math mode only

Where it is used

Set-builder notation: the set of all x for which the property P(x) holds, written with braces and a divider.

Braces must be escaped as \{ and \} in math mode, otherwise they only group and vanish from the output. \mid is a relation, so it gets proper space on both sides, unlike a bare | which is an ordinary symbol and crowds the letters. When the condition contains fractions or tall material, size everything together: \left\{ x \;\middle|\; \frac{x}{2} \in \mathbb{Z} \right\}. A colon works equally well as the separator and avoids confusion when the condition itself contains absolute values.

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

{x∈R∣x2−1<0}=(−1,1)\{ x \in \mathbb{R} \mid x^2 - 1 < 0 \} = (-1, 1)
\documentclass{article}
\usepackage{amssymb}
\begin{document}
Set Builder: $\{ x \mid P(x) \}$

\[ \{ x \in \mathbb{R} \mid x^2 - 1 < 0 \} = (-1, 1) \]
\end{document}

Related symbols

All Quantifiers →

Frequently asked questions

How do I write Set Builder in LaTeX?
Type \{ x \mid P(x) \} in math mode, for example $\{ x \in \mathbb{R} \mid x^2 - 1 < 0 \} = (-1, 1)$. It works in plain LaTeX without loading any package.
Which package do I need for \{ x \mid P(x) \}?
None. \{ x \mid P(x) \} is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use \{ x \mid P(x) \} in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\{ x \mid P(x) \}$ in running text.
Math poweredSumulat ng LaTeX gamit ang AI

Pinakamahusay na AI LaTeX Editor, Alternatibo sa Overleaf

Tinutulungan ng Octree ang mga researcher mula sa 15+ na unibersidad na sumulat ng research papers nang mas mabilis gamit ang AI

  • Gumawa ng magagandang TikZ diagrams gamit ang AI
  • Mag-upload ng larawan at i-convert ito sa LaTeX nang walang problema
  • Makakuha ng instant na tulong sa pagsulat at pag-format ng research papers