32

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.

3

3 Answers 3

30

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.

2
  • Mathtools is a relatively new package, so if \usepackage{mathtools} generates 'package not found' error in MiKTeX, you may need to synchronize mpm's repository catalog. The instructions here resolved the issue for me. Apr 2, 2016 at 2:36
  • 1
    The main point is it's not installed by default in a basic installation of MiKTeX.
    – Bernard
    Apr 2, 2016 at 8:54
15

You need to escape the braces like \{ and \}.

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

Also possible to use dynamic delimiter sizing with \left and right, example below.

Calculate the first 4 terms of the sequence below, here typeset
without dynamic delimiter sizing:

\begin{equation}
\{ a_n \} = \{ -(\frac{1}{n})^n \}
\end{equation}

With dynamic delimiter sizing of the curly braces using `\left` and
`\right` the sequence looks like

\begin{equation}
\{ a_n \} = \left\{ -(\frac{1}{n})^n  \right\}
\end{equation}

Off course we can also apply this to the parenthesis

\begin{equation}
\{ a_n \} = \left\{ - \left( \frac{1}{n} \right)^n  \right\}
\end{equation}

Finally, the answer to the question is $\{ -1,1/4,-1/27,1/256,... \}$

Curly braces typeset with dynamic sizing

1
  • 1
    This answer is way too far down. YES, ´\left\{´ and ´\right\}´ are the commands that adapt the curly bracket sizes to the content height.
    – kalle
    Nov 21, 2023 at 12:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .