# Visually grouping split equation

Is it possible to put a line next to a split equation indicating that the equation number applies to multiple lines? I'd like to achieve a similar effect to that in the following image:

MWE:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}

\newcommand{\iu}{\mathrm{i}} %imaginary unit
\newcommand{\eu}{\mathrm{e}} %euler number
\newcommand{\dd}[1]{{\mathrm{d}#1}} %derivative
\usepackage{dutchcal} %Cursive font for Res operator
\newcommand{\res}[2]{\mathop{\mathcal{Res}}\limits_{#1}\left\{{#2}\right\}}

\begin{document}

The residues can be calculated. All poles are of order 1, so this is an easy task.
\begin{align}
\begin{split}
\res{z=\iu}{p(z)}&=\lim_{z\rightarrow\iu}(z-\iu)p(z)\\
&=\lim_{z\rightarrow\iu}\frac{z-\iu}{\left(z+\iu\right)\left(z-\iu\right)\left(z+2\iu\right)\left(z-2\iu\right)}\\
&=\lim_{z\rightarrow\iu}\frac{1}{\left(z+\iu\right)\left(z+2\iu\right)\left(z-2\iu\right)}\\
&=-\frac{\iu}{6}
\end{split}\label{eqn:q2_res1}
\end{align}
\begin{align}
\begin{split}
\res{z=2\iu}{p(z)}&=\lim_{z\rightarrow 2\iu}(z-2\iu)p(z)\\
&=\lim_{z\rightarrow 2\iu}\frac{z-2\iu}{\left(z+\iu\right)\left(z-\iu\right)\left(z+2\iu\right)\left(z-2\iu\right)}\\
&=\lim_{z\rightarrow 2\iu}\frac{1}{\left(z+\iu\right)\left(z-\iu\right)\left(z+2\iu\right)}\\
&=\frac{\iu}{12}
\end{split}\label{eqn:q2_res2}
\end{align}

\end{document}


Here is a way, with the empheq package (which loads mathtools) and flalign. Note one can have two variants, according to the placement of the &:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{empheq}

\newcommand{\iu}{\mathrm{i}} %imaginary unit
\newcommand{\eu}{\mathrm{e}} %euler number
\newcommand{\dd}[1]{{\mathrm{d}#1}} %derivative
\usepackage{dutchcal} %Cursive font for Res operator
\newcommand{\res}[2]{\mathop{\mathcal{Res}}\limits_{#1}\left\{{#2}\right\}}

\begin{document}

The residues can be calculated. All poles are of order 1, so this is an easy task.
\begin{empheq}[right = \empheqrbrace]{flalign}
& & &\begin{split}
\res{z=\iu}{p(z)}&=\lim_{z → \iu}(z-\iu)p(z) \\
& =\lim_{z → \iu}\frac{z-\iu}{\left(z+\iu\right)\left(z-\iu\right)\left(z+2\iu\right)\left(z-2\iu\right)}\\
& =\lim_{z → \iu}\frac{1}{\left(z+\iu\right)\left(z+2\iu\right)\left(z-2\iu\right)}\\
& =-\frac{\iu}{6}
\end{split} & &
\label{eqn:q2_res1}
\end{empheq}
\vspace{6ex}
\begin{empheq}[right=\empheqrbrack]{flalign}
& & \begin{split}
\res{z=2\iu}{p(z)}&=\lim_{z → 2\iu}(z-2\iu)p(z)\\
&=\lim_{z → 2\iu}\frac{z-2\iu}{\left(z+\iu\right)\left(z-\iu\right)\left(z+2\iu\right)\left(z-2\iu\right)}\\
&=\lim_{z → 2\iu}\frac{1}{\left(z+\iu\right)\left(z-\iu\right)\left(z+2\iu\right)}\\
&=\frac{\iu}{12}
\end{split} & \label{eqn:q2_res2}
\end{empheq}

\end{document}


• Is there any way, within a single align environment, to automatically do this for all equations encapsulated within split, but not stand-alone equations? Commented Apr 4, 2017 at 9:01
• Do you mean several split environments, each with its own brace or bracket? Commented Apr 4, 2017 at 9:15
• Yes. I want to have a single align environment, within which I would have both single-line equations and split equations across multiple lines. I'd like the bracket placement to occur only for the equations spanning multiple lines. Commented Apr 6, 2017 at 1:50

By enclosing the whole equation set in an array and using \left. \right].

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}

\newcommand{\iu}{\mathrm{i}} %imaginary unit
\newcommand{\eu}{\mathrm{e}} %euler number
\newcommand{\dd}[1]{{\mathrm{d}#1}} %derivative
\usepackage{dutchcal} %Cursive font for Res operator
\newcommand{\res}[2]{\mathop{\mathcal{Res}}\limits_{#1}\left\{{#2}\right\}}

\begin{document}

The residues can be calculated. All poles are of order 1, so this is an easy task.
\left. \begin{array}{c} \begin{aligned} \res{z=\iu}{p(z)}&=\lim_{z\rightarrow\iu}(z-\iu)p(z)\\ &=\lim_{z\rightarrow\iu}\frac{z-\iu}{\left(z+\iu\right)\left(z-\iu\right)\left(z+2\iu\right)\left(z-2\iu\right)}\\ &=\lim_{z\rightarrow\iu}\frac{1}{\left(z+\iu\right)\left(z+2\iu\right)\left(z-2\iu\right)}\\ &=-\frac{\iu}{6} \end{aligned}\label{eqn:q2_res1} \end{array} \qquad \right]
%
\left. \begin{array}{c} \begin{aligned} \res{z=2\iu}{p(z)}&=\lim_{z\rightarrow 2\iu}(z-2\iu)p(z)\\ &=\lim_{z\rightarrow 2\iu}\frac{z-2\iu}{\left(z+\iu\right)\left(z-\iu\right)\left(z+2\iu\right)\left(z-2\iu\right)}\\ &=\lim_{z\rightarrow 2\iu}\frac{1}{\left(z+\iu\right)\left(z-\iu\right)\left(z+2\iu\right)}\\ &=\frac{\iu}{12} \end{aligned}\label{eqn:q2_res2} \end{array} \qquad \right]

\end{document}


Also for TikZ lovers, here is a nice solution. What I like most about this method is that the brackets are drawn on-top of the text and don't interfere with your math setup whatsoever.

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}

\usepackage{tikz}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture]{\coordinate(#1);}}

\newcommand{\iu}{\mathrm{i}} %imaginary unit
\newcommand{\eu}{\mathrm{e}} %euler number
\newcommand{\dd}[1]{{\mathrm{d}#1}} %derivative
\usepackage{dutchcal} %Cursive font for Res operator
\newcommand{\res}[2]{\mathop{\mathcal{Res}}\limits_{#1}\left\{{#2}\right\}}

\begin{document}

The residues can be calculated. All poles are of order 1, so this is an easy task.
\begin{aligned} \res{z=\iu}{p(z)}&=\lim_{z\rightarrow\iu}(z-\iu)p(z)\tikzmark{1}\\ &=\lim_{z\rightarrow\iu}\frac{z-\iu}{\left(z+\iu\right)\left(z-\iu\right)\left(z+2\iu\right)\left(z-2\iu\right)}\\ &=\lim_{z\rightarrow\iu}\frac{1}{\left(z+\iu\right)\left(z+2\iu\right)\left(z-2\iu\right)}\\ &=-\frac{\iu}{6}\tikzmark{2} \end{aligned}\label{eqn:q2_res1}
\begin{aligned} \res{z=2\iu}{p(z)}&=\lim_{z\rightarrow 2\iu}(z-2\iu)p(z)\tikzmark{3}\\ &=\lim_{z\rightarrow 2\iu}\frac{z-2\iu}{\left(z+\iu\right)\left(z-\iu\right)\left(z+2\iu\right)\left(z-2\iu\right)}\\ &=\lim_{z\rightarrow 2\iu}\frac{1}{\left(z+\iu\right)\left(z-\iu\right)\left(z+2\iu\right)}\\ &=\frac{\iu}{12}\tikzmark{4} \end{aligned}\label{eqn:q2_res2}

\begin{tikzpicture}[remember picture, overlay, thin]
\coordinate [xshift=-2in] (u) at (1-|current page.east);
\coordinate [xshift=-2in] (l) at (2-|current page.east);
\draw ([xshift=-2mm]u)--(u)--(l)--++(-2mm,0mm);
%
\coordinate [xshift=-2in] (u) at (3-|current page.east);
\coordinate [xshift=-2in] (l) at (4-|current page.east);
\draw ([xshift=-2mm]u)--(u)--(l)--++(-2mm,0mm);
\end{tikzpicture}

\end{document}