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}
________________

  • \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

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

  • 1
    What if I need to make a box only around the equation excluding implies sign. – kaka Jan 17 '15 at 9:37
  • 1
    @kaka Please see FOLLOW UP in my revision. – Steven B. Segletes Jan 17 '15 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.