Tx · LaTeX & TikZ

How to Create Multiline Curly Braces in LaTeX

Published By the 9to5Science editorial team

At a glance

  1. 1. Open the brace

    Use \left\{ for a curly brace that grows to match multiline content.

  2. 2. Align the lines

    Place the lines in an aligned, array, or cases environment.

  3. 3. Close invisibly

    Use \right. when the expression needs only a left brace.

  4. 4. Add a label

    Put text or a condition after the aligned block, outside the brace.

A multiline curly brace in LaTeX is usually made with a left delimiter and an invisible right delimiter. The essential pattern is \left\{ ... \right. with the multiline material placed inside aligned or array. For piecewise definitions, use cases, which supplies its own large left brace.

The command \left\{ prints a curly brace whose height adapts to the contents. The matching \right. is required because \left and \right must occur in pairs; the period means “print no visible delimiter.”

The basic pattern

Use the amsmath package and put an aligned environment between the delimiters:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\[
\left\{
\begin{aligned}
  x + y &= 10,\\
  x - y &= 2
\end{aligned}
\right.
\]

\end{document}

This produces a single large curly brace to the left of two aligned equations. Inside aligned, & marks the alignment point and \\ starts a new line.

The brace is not made by typing several ordinary { characters. In LaTeX, an ordinary { begins a group and is not normally printed. To print a literal brace, you must escape it as \{; for a scalable brace, use it as the delimiter in \left\{.

A piecewise function

For a piecewise definition, the cases environment is usually the clearest choice. It automatically supplies a large left brace and aligns the condition column:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\[
f(x) =
\begin{cases}
  x^2, & x \geq 0,\\
  -x,  & x < 0.
\end{cases}
\]

\end{document}

The cases environment is provided by amsmath. Each row has two columns separated by &, and \\ separates rows. The first column contains the function value; the second gives the condition.

For example, the result represents

f(x)={x2,x≥0,−x,x<0.f(x) = \begin{cases} x^2, & x \geq 0,\\ -x, & x < 0. \end{cases}

Use cases when the content is explicitly a piecewise function. Use aligned when you need more general control over equations, punctuation, or labels.

Adding text after the brace

Because \right. is invisible, you can continue the expression immediately after the multiline block:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\[
\left\{
\begin{aligned}
  a &= 1,\\
  b &= 2,\\
  c &= 3
\end{aligned}
\right.
\quad\text{for } n = 1,2,3.
\]

\end{document}

The command \quad adds horizontal space, while \text{...} typesets ordinary words in an upright text font within math mode. The \text command is also supplied by amsmath.

You can place a visible delimiter on both sides if that is what the notation requires. For example:

\[
\left\{
\begin{aligned}
  p &= q,\\
  r &= s
\end{aligned}
\right\}
\]

Here, \right\} prints a matching right curly brace. The right brace will grow to the height of the entire aligned block.

Using an array for custom columns

An array is useful when the rows contain text or when you want to specify column alignment explicitly:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\[
\left\{
\begin{array}{ll}
  1 & \text{if the input is valid},\\
  0 & \text{otherwise}
\end{array}
\right.
\]

\end{document}

The argument {ll} specifies two left-aligned columns. Other common column specifications are c for centered and r for right-aligned. Unlike aligned, array is designed for a table-like structure and lets you choose the alignment of every column.

Common mistakes

Forgetting \right.

This is incomplete:

\[
\left\{
\begin{aligned}
  x &= 1,\\
  y &= 2
\end{aligned}
\]

Every \left delimiter needs a corresponding \right delimiter. Since no visible right delimiter is wanted, add \right.:

\[
\left\{
\begin{aligned}
  x &= 1,\\
  y &= 2
\end{aligned}
\right.
\]

Using \\ outside a multiline environment

The line break command belongs inside aligned, array, or cases. It does not turn an ordinary sequence of math symbols into a multiline expression by itself.

Using \big\{ for arbitrary content

Commands such as \big\{, \Big\{, and \Bigg\{ create manually sized braces. They can work for short expressions, but they do not automatically adapt to the height of several rows. Prefer \left\{ with \right. for multiline material.

Omitting the amsmath package

The aligned, cases, and \text commands require amsmath. Add this line to the preamble:

\usepackage{amsmath}

For a simple one-line literal brace, \{ works without amsmath; multiline layouts are more reliable with the package.

References

  1. The amsmath Package documentation
  2. LaTeX2e: An unofficial reference manual

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.