Boxing Multiple Lines in Split
The amsmath
package provides a macro called \boxed
for just this purposes. Note that I encased an aligned
environment inside the \boxed
directive. And I also replaced all instances of \left(\frac{\omega}{c}\right)
with (\omega/c)
to achieve a more compact appearance of the formulas.
In the following solution, the =
symbol is not inside the box. If it has to be inside the box, you'll need to replace
%Box starting here
&=\boxed{\begin{aligned}[t]
&\biggl(\frac{\pi B_0}{2\left[(\omega/c)^2-k^2\right]}\biggr)^{\!2}
with
%Box starting here
&\boxed{\begin{aligned}
&=\biggl(\frac{\pi B_0}{2\left[(\omega/c)^2-k^2\right]}\biggr)^{\!2}
in the code given below.
\documentclass{article}
\usepackage[letterpaper,margin=1in]{geometry} % set page parameters appropriately
\usepackage{amsmath}
\usepackage{mleftright} % for tightly-spaced \left...\right constructs
\mleftright
\begin{document}
\begin{equation}
\begin{split}
\langle\vec{u}\mkern1.5mu\rangle
&=\frac{1}{4}\Re\Bigl( \epsilon_0\vec{\widetilde{E}}\cdot\vec{\widetilde{E}}^*
+\frac{1}{\mu_0}\vec{\widetilde{B}}\cdot\vec{\widetilde{B}}^* \Bigr) \\
&=\frac{1}{4}
\Biggl[
\epsilon_0
\left(\frac{\pi\omega B_0}{(\omega/c)^2-k^2}\right)^{\!2}
\left[\left(\frac{n}{b}\right)^2\cos^2
\left(\frac{m\pi}{a}x\right)\sin^2
\left(\frac{n\pi}{b}y\right)
+\left(\frac{m}{a}\right)^2\sin^2
\left(\frac{m\pi}{a}x\right)\cos^2
\left(\frac{n\pi}{b}y\right)\right] \\
&\qquad+\frac{1}{\mu_0}
\left(\frac{\pi kB_0}{(\omega/c)^2-k^2}\right)^{\!2}
\left[\left(\frac{m}{a}\right)^2\sin^2
\left(\frac{m\pi}{a}x\right)\cos^2
\left(\frac{n\pi}{b}y\right)
+\left(\frac{n}{b}\right)^2\cos^2
\left(\frac{m\pi}{a}x\right)\sin^2
\left(\frac{n\pi}{b}y\right)\right. \\
&\qquad\qquad
\left(\frac{(\omega/c)^2-k^2}{\pi k}\right)\cos^2
\left(\frac{m\pi}{a}x\right)\cos^2
\left(\frac{n\pi}{b}y\right)
\Biggr] \\
%Box starting here
&=\boxed{\begin{aligned}[t]
&\biggl(\frac{\pi B_0}{2\left[(\omega/c)^2-k^2\right]}\biggr)^{\!2}
\Biggl[
\left(\epsilon_0\omega+\frac{k}{\mu_0}\right)
\biggl[\left(\frac{n}{b}\right)^2\cos^2
\left(\frac{m\pi}{a}x\right)\sin^2
\left(\frac{n\pi}{b}y\right) \\
&\qquad+\left(\frac{m}{a}\right)^2\sin^2
\left(\frac{m\pi}{a}x\right)\cos^2
\left(\frac{n\pi}{b}y\right)\biggr]
+\left(\frac{(\omega/c)^2-k^2}{\pi\mu_0k}\right)\cos^2
\left(\frac{m\pi}{a}x\right)\cos^2
\left(\frac{n\pi}{b}y\right)
\Biggr]
\end{aligned}}
%and ending here
\end{split}
\end{equation}
\end{document}