LaTeX Union Symbol: Set Notation Commands Reference
November 11, 2026 · 10 min read
LaTeX Union Symbol and Set Notation: ∪, ∩, ⊆, ∈ and ∅
The LaTeX union symbol is \cup, typed in math mode as $A \cup B$ to print A ∪ B. For a union over many sets, use the large operator \bigcup. This reference covers the set commands you'll actually use, which look-alike to pick, which ones need amssymb, and how they render in Markdown math.
LaTeX Union Symbol: \cup for Two Sets, \bigcup for Many
\cup is the set union symbol LaTeX uses between two sets. It's a binary operator, so LaTeX adds a medium space on each side for you. \bigcup is a variable-sized operator, the set counterpart of \sum. It grows in display math and takes its limits the same way a sum does.
Don't swap them. A \bigcup B prints a bigger symbol with the wrong spacing, and \cup_{i=1}^{n} leaves a small cup with limits stuck to it like exponents.
$A \cup B$
$\bigcup_{i=1}^{n} A_i$
$$\bigcup_{i=1}^{n} A_i$$
Inline, the limits sit beside the symbol as a subscript and superscript, which keeps your line spacing even: . In display math they move under and over it:
To force under-and-over limits inline, add \limits, as in \bigcup\limits_{i=1}^{n} A_i. Use it sparingly, because it pushes the surrounding lines apart. Our LaTeX summation guide covers the same limit rules for \sum.
Two variants appear in some textbooks for disjoint unions: \sqcup (⊔) and \uplus (⊎). Both are base LaTeX, and so are their large forms \bigsqcup and \biguplus.
A common first error: type \cup in ordinary text and LaTeX stops with Missing $ inserted, because the command only exists in math mode. The fix is to wrap the expression in dollar signs.
Intersection Symbol in LaTeX: \cap and \bigcap
The intersection symbol LaTeX uses is \cap (∩), with \bigcap as the large version. It follows the same limit rules as \bigcup, and you can index over any set by putting the condition in the subscript.
$A \cap B$
$$\bigcap_{i \in I} A_i$$
That renders as inline, while the display line stacks i ∈ I under a large ∩, exactly as \bigcup does.
Don't rely on a precedence rule between ∪ and ∩. Write the parentheses, because and are different sets. For tall contents, \left( and \right) stretch the brackets to fit.
Should You Use \subset, \subseteq or \subsetneq?
Which LaTeX subset symbol you want depends on whose convention you follow, because textbooks differ. Some authors write ⊂ for any subset, while others reserve it for a proper subset. Pairing \subseteq (⊆) with \subsetneq (⊊) removes the doubt, since each glyph has only one reading. For the meaning of each sign, see our guide to math set symbols.
| Command | Renders | Package in a .tex file | Typical use |
|---|---|---|---|
\subset | none | subset, proper or not, by author | |
\subseteq | none | subset or equal | |
\subsetneq | amssymb | proper subset | |
\varsubsetneq | amssymb | proper subset, longer slash | |
\supset, \supseteq | , | none | superset |
\supsetneq | amssymb | proper superset | |
\nsubseteq | amssymb | not a subset or equal | |
\not\subset | none | not a subset |
\not overlays a slash on any relation, which is why \not\subset works without a package. \nsubseteq is a purpose-drawn glyph from amssymb, and it negates ⊆ rather than ⊂.
Empty Set Symbol in LaTeX: \emptyset or \varnothing?
Both commands print the empty set, but they look different. \emptyset is base LaTeX and draws a tall oval with a slash, close to a slashed zero. \varnothing comes from amssymb and draws a rounder circle. Side by side: and .
The Comprehensive LaTeX Symbol List notes that many people prefer the look of \varnothing. We prefer it too, because readers don't mistake it for a struck-through zero. KaTeX renders both with no setup.
Two impostors to avoid. \O is the letter Ø for text mode, so it isn't meant for math, and KaTeX rejects it in math mode as an undefined control sequence. \phi is the Greek letter phi (ϕ). Neither is the empty set, and both look wrong next to set operators. If you want an explicitly empty pair of braces instead, write \{\}.
Element Of, Set Difference and Complement: \in, \notin, \setminus
Membership and difference round out the everyday set commands. Everything in this list is base LaTeX except \smallsetminus:
\ingives ∈,\notingives ∉, and\nigives the reversed ∋.\setminusgives ∖ with binary-operator spacing, as in .\backslashdraws a similar stroke as an ordinary symbol, so it sits cramped between two sets.- amssymb adds
\smallsetminus, a shorter difference sign: .
Complement has three common spellings: A^c, A^\complement (amssymb) and \overline{A}. They render as , and . Pick one per document and stay with it.
Three more commands sit next to these in most problem sets. Cardinality is \lvert A \rvert, which gives with correct delimiter spacing (amsmath in a .tex file). The power set is usually \mathcal{P}(A), giving , and the Cartesian product is A \times B. Both are base LaTeX.
How Do You Write Set-Builder Notation in LaTeX?
Braces are LaTeX's grouping characters, so a literal brace needs a backslash: \{ and \}. Separate the variable from its condition with \mid, not a bare |.
$$S = \{ x \in A \mid x > 0 \}$$
$$T = \{ x \in A \colon x \neq 0 \}$$
$$U = \left\{ \frac{1}{n} \mid n \geq 1 \right\}$$
$$R = \{1, 2, 3\}$$
The first line renders like this:
\mid is a relation, so it gets space on both sides, while | is an ordinary symbol and hugs the x. \colon is the other common separator. \left\{ ... \right\} stretches the braces around tall contents like fractions, and roster form simply lists the elements.
Markdown adds two traps. In a GFM table, a bare | ends the cell even inside dollar signs, so a set-builder with | splits in two. \mid avoids that. Some Markdown processors also strip the backslash from \{ before the math renderer sees it, so the braces vanish. \lbrace and \rbrace draw the same braces with no backslash-escaped punctuation, so they survive any Markdown parser. GitHub's math docs offer the $`...`$ form for math that clashes with Markdown syntax.
Number sets like \mathbb{R} need amssymb (or amsfonts) in a .tex file, while KaTeX has \mathbb built in, along with shortcuts like \R and \Z that plain LaTeX doesn't define.
The editor below is pre-filled with these commands. Edit any line and the KaTeX preview updates, so you can check a command before you paste it elsewhere.
How to Find the Union and Intersection of Two Sets, Written in LaTeX
The union collects every element that's in either set, and the intersection keeps only the shared ones. Here's a worked example with the equals signs lined up by the aligned environment:
$$
\begin{aligned}
A &= \{1, 2, 3\}, \quad B = \{2, 3, 4\} \\
A \cup B &= \{1, 2, 3, 4\} \\
A \cap B &= \{2, 3\} \\
A \setminus B &= \{1\}
\end{aligned}
$$
Paste it into Markdown with KaTeX math and the four rows line up on their equals signs. Written on one line, the three results render like this:
Each & marks the alignment point and \\ starts a new row. KaTeX supports aligned, so this works in Markdown math as written. In a .tex file it needs the amsmath package. The same display block handles grids too, as our guide to matrices in Markdown shows.
Which Set Commands Need amssymb, and Which Render in KaTeX?
This table answers both questions for every command above. "None" means the command ships with LaTeX itself. For relations, logic and arrows, see the broader LaTeX symbols list.
| Command | Renders | Package in a .tex file | KaTeX |
|---|---|---|---|
\cup, \cap | , | none | yes |
\bigcup, \bigcap | , | none | yes |
\sqcup, \uplus | , | none | yes |
\subset, \subseteq | , | none | yes |
\subsetneq, \nsubseteq | , | amssymb | yes |
\in, \notin, \ni | , , | none | yes |
\lbrace, \rbrace | , | none | yes |
\lvert, \rvert | , | amsmath | yes |
\setminus | none | yes | |
\smallsetminus | amssymb | yes | |
\emptyset | none | yes | |
\varnothing | amssymb | yes | |
\complement | amssymb | yes | |
aligned | multi-line | amsmath | yes |
In a .tex file, load both packages in the preamble. amssymb also loads amsfonts, which supplies \mathbb.
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
Markdown math has no preamble, because KaTeX ships these commands already. Its supported functions list is the place to check anything not in this table. One limitation to know: our editor reads only $...$ and $$...$$, not \(...\) or \[...\]. Our Markdown equation guide covers delimiters and renderers. If your document is mostly proofs, Markdown vs LaTeX helps you decide whether a full .tex file fits better.
You now have the LaTeX union symbol and the set commands around it: \cup and \bigcup, unambiguous subset signs, \varnothing for the empty set and \mid for set-builder notation. Try any of them in our LaTeX equation editor, which renders with KaTeX and copies a Markdown math snippet. Or paste a whole document into the editor and watch the preview update as you type.