# aboxed across multiple alignment

I would like to have the entire last line in a box, but when I compile, it only boxes the first equation and doesn't even print the second equation. Does anyone know how to fix this?

Here's my MWE.

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

\begin{document}

\begin{alignat*}{3}
\left| x \right. & \left. - 2 \right| & &=1 &\\
x - 2 &= 1& &\text{ or } & x - 2 &= -1\\
\Aboxed{x &= 3& &\text{ or }& x &= 1}
\end{alignat*}

\end{document}


I was going to include an image of what it produces, but it won't let me since I'm a new user. :)

-

It possible to create a box of the correct width to span across the entries in the last row manually:

\documentclass[12pt]{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}

\begin{alignat*}{3}
\left| x \right. & \left. - 2 \right| & &=1 &\\
x - 2 &= 1& &\text{ or } & x - 2 &= -1\\
\rlap{\kern\dimexpr-\fboxsep-\fboxrule\relax\fbox{\phantom{$x=3\text{ or\ \ }x - 2 = 1$}}}% Phantom box
x &= 3& &\text{ or }& x &= 1
\end{alignat*}

\end{document}​


The approach here is to create a box with fake (or \phantom) content that matches the output generated via alignat*. Minor \kerning allows for appropriate placement due to \fbox separation (\fboxsep) and rule width (\fboxrule).

-
Werner, thank you. I'd prefer something less "manual-formatty", but this works! –  Keila Sep 10 '12 at 22:24
@Keila: Less manual could require an overlay using something like tikz. –  Werner Sep 10 '12 at 22:26