How to Put Two Multiline Brace Groups Around an Arrow in LaTeX
At a glance
- 1. Load amsmath
Add the amsmath package to your document preamble.
- 2. Build each group
Put each set of aligned lines inside an aligned environment, enclosed by a left brace and an invisible right delimiter.
- 3. Insert the arrow
Place a long arrow between the two brace groups in the same display-math environment.
To place two multiline groups in braces with an arrow between them, put each group in an aligned environment and enclose it in a scalable left brace. Use \right. for an invisible matching delimiter; LaTeX needs a matching right delimiter whenever you write \left.
The example below shows one system being rewritten as another. It uses amsmath, which provides the aligned environment. You do not need eqnarray for this layout.
Complete example
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\left\{
\begin{aligned}
x + y &= 5,\\
2x - y &= 1
\end{aligned}
\right.
\quad\longrightarrow\quad
\left\{
\begin{aligned}
x &= 2,\\
y &= 3
\end{aligned}
\right.
\]
\end{document}
The two rows in each aligned block break at \\. Put & before the part you want to align—in this example, it aligns the equals signs. Each \left\{ starts a brace that grows to fit the lines, and the corresponding \right. supplies an invisible delimiter on the right. The \quad commands add horizontal space around the arrow.
Why not use eqnarray?
The eqnarray environment is an older way to align equations, but its spacing around relation symbols such as = is often wider than standard mathematical spacing. The amsmath environments are more consistent and give you control over the alignment. For a multiline group inside a larger formula, aligned is a good fit because it can be used within display math alongside other symbols, including the arrow.
If you already have an eqnarray version, replace it with the aligned blocks shown above. Keep the whole expression inside one display-math environment so the braces, lines, and arrow are arranged as a single unit.
Variations
To show right braces instead of invisible right delimiters, use \right\} in place of \right.. To make the arrow shorter, use \to instead of \longrightarrow. If you want the arrow closer to the braces, reduce or remove the surrounding \quad spacing.
For a single multiline group with only a left brace, use the same pattern with one aligned block and \right.. If the lines are not equations to be aligned at a particular symbol, you can still use aligned; omit the alignment marker or place it where it gives the layout you want.
Common mistakes
- Leaving out
\right.:\leftand\rightmust be paired. An invisible delimiter is written as.. - Using
\left\{without a multiline structure: The brace only sizes itself to the material inside it. Place the lines inalignedso they form one group. - Putting the arrow on a new display line: Keep the arrow between the two groups inside the same display-math environment.
- Forgetting
amsmath: Add\usepackage{amsmath}in the preamble; otherwisealignedmay be undefined. - Using
eqnarrayby default: It can work for some layouts, butalignedgenerally gives better spacing and clearer structure.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.