2

\Aboxed command in mathtools is used to box an equation with only one alignment operator inside.

But how to box an equation with multiple align operators ?

For instance, in the following equations, how can I box one complete equation?


\begin{frame}
\begin{align*}
&\therefore&  \theta_1 & >  \theta_0 \\
&\Rightarrow&  P+\frac{1}{\rho}\sigma_n^2 & > \rho\sigma_n^2 \\
\Aboxed{&\Rightarrow&\frac{P}{\sigma_n^2}} & >  \frac{\rho^2-1}{\rho} \\
 \end{align*}
 \end{frame}
________________

David Carlisle
  • 757,742
kaka
  • 546
  • 2
  • 6
  • 20
  • 2
    \Aboxed can only have one & inside, because the macro is defined such that it reads all content up to the & and the content from the & to the end. Then the both parts are put into an \fbox and shifted right (by measuring the second half) such that they align with the rest. – Henri Menke Jan 16 '15 at 21:42

1 Answers1

1

It isn't automatic, but it works. It \rlaps an \fbox.

\documentclass{beamer}
\usepackage{amsmath}
\begin{document}
\begin{frame}
\begin{align*}
&\therefore&  \theta_1 & >  \theta_0 \\
&\Rightarrow&  P+\frac{1}{\rho}\sigma_n^2 & > \rho\sigma_n^2 \\
\rlap{\fbox{\rule[-10pt]{0pt}{25pt}\rule{170pt}{0pt}}}&\Rightarrow&\frac{P}{\sigma_n^2}
& >  \frac{\rho^2-1}{\rho} \\
 \end{align*}
 \end{frame}
\end{document}

enter image description here


FOLLOW UP:

To make the box only around the equation, move it right a few alignment tabs and shorten the horizontal rule length. I also did a negative kern to add some padding.

\documentclass{beamer}
\usepackage{amsmath}
\begin{document}
\begin{frame}
\begin{align*}
&\therefore&  \theta_1 & >  \theta_0 \\
&\Rightarrow&  P+\frac{1}{\rho}\sigma_n^2 & > \rho\sigma_n^2 \\
&\Rightarrow&\rlap{\kern-1ex\fbox{\rule[-10pt]{0pt}{25pt}\rule{62pt}{0pt}}}
\frac{P}{\sigma_n^2}& >  \frac{\rho^2-1}{\rho} \\
 \end{align*}
 \end{frame}
\end{document}

enter image description here