15

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.

20

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.

  • 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. – Assad Ebrahim Apr 2 '16 at 2:36
  • 1
    The main point is it's not installed by default in a basic installation of MiKTeX. – Bernard Apr 2 '16 at 8:54
7

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.