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 한정자 →

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 poweredAI로 LaTeX 작성

최고의 AI LaTeX 편집기, Overleaf 대안

Octree는 15개 이상의 대학의 연구자들이 AI를 사용하여 논문을 더 빠르게 작성하도록 도움

  • AI로 아름다운 TikZ 다이어그램 생성
  • 이미지를 업로드하고 LaTeX로 원활하게 변환
  • 논문 작성 및 서식에 대한 즉각적인 지원 받기