[Tex/LaTex] How to put a side brace around several lines in the align* environment

align

I would like to put a side brace around several lines in the align* environment, as shown in the comments in the code below:

\begin{align*}
    left side & = right side \\
    left side & = right side \\  %   }
    left side & = right side \\  %   }-  these three lines are important
    left side & = right side \\  %   }
    left side & = right side \\
\end{align*}

Best Answer

You don't need any additional packages to do this. Here's a way using a regular array:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\noindent
\begin{minipage}{.5\textwidth}
\begin{align*}
    f(x) & = a \\
    g(x) & = ax + b \\
    h(x) & = ax^2 + bx + c \\
    i(x) & = ax^3 + bx^2 + cx + d \\
    j(x) & = ax^4 + bx^3 + cx^2 + dx + e
\end{align*}
\end{minipage}%
\begin{minipage}{.5\textwidth}
\[
  \setlength{\jot}{4.5pt}
  \begin{array}{r@{\;}l}
    f(x) & = a \\[\jot]
    g(x) & = ax + b \\[\jot]
    h(x) & = ax^2 + bx + c \hspace*{3em}
      \smash{\left.\begin{array}{@{}c@{}}\\[\jot]\\[\jot]\\[\jot]\end{array}\right\}} \\[\jot]
    i(x) & = ax^3 + bx^2 + cx + d \\[\jot]
    j(x) & = ax^4 + bx^3 + cx^2 + dx + e
  \end{array}
\]
\end{minipage}%
\end{document}

On the left is the regular align* environment (from amsmath), while the right should an array. A zero-height 3-row array with only a right \} delimiter is added to the middle equation to group the output.


Another option, this time using blkarray:

enter image description here

\documentclass{article}
\usepackage{blkarray}% http://ctan.org/pkg/blkarray
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\noindent
\begin{minipage}{.5\textwidth}
\begin{align*}
    f(x) & = a \\
    g(x) & = ax + b \\
    h(x) & = ax^2 + bx + c \\
    i(x) & = ax^3 + bx^2 + cx + d \\
    j(x) & = ax^4 + bx^3 + cx^2 + dx + e
\end{align*}
\end{minipage}%
\begin{minipage}{.5\textwidth}
\[
  \def\arraystretch{1.1}
  \begin{blockarray}{r@{\;}l}
    f(x) & = a \\[\jot]
    \begin{block}{r@{\;}l\}}
      g(x) & = ax + b \\[\jot]
      h(x) & = ax^2 + bx + c \\[\jot]
      i(x) & = ax^3 + bx^2 + cx + d \\[\jot]
    \end{block}
    j(x) & = ax^4 + bx^3 + cx^2 + dx + e
  \end{blockarray}
\]
\end{minipage}%
\end{document}

You may have to play around with the vertical displacement, compared to the align* environment.

Related Question