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 Kuantifier →

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 poweredTulis LaTeX menggunakan AI

Editor LaTeX AI Terbaik, Alternatif Overleaf

Octree membantu penyelidik dari 15+ universiti menulis kertas penyelidikan dengan lebih cepat menggunakan AI

  • Jana diagram TikZ yang cantik menggunakan AI
  • Muat naik imej dan tukar ke LaTeX dengan lancar
  • Dapatkan bantuan segera untuk menulis dan memformat kertas penyelidikan