[Tex/LaTex] Curly braces in math mode

math-mode

How do I get curly braces to show in math mode? When I write this:

$ K_1 = {s_1}, K_2 = {s_2, s_3, s_4} $

the braces disappear in the output.

Best Answer

Use \{…\}. But, as the contents inside the braces may vary in size, it would be better to use the DeclarePairedDelimiter command from the mathtools package:

\DeclarePairedDelimiter\set\{\}

This defines a \set{…} command, which accepts an optional argument: \big, \Big, \bigg, or \Bigg, which implicitly adds a pair of \bigl…\bigr, &c. in front of the braces. Example: \set[\big]{...}

A \set*{…} variant becomes available for free, which adds implicitly a pair of \left…\right.

Related Question