I am trying to use \Aboxed around a function containing a pmatrix, but anything other than a column vector seems to break \Aboxed. I think it has something to do with the &'s in the matrix, but I am not sure. \boxed seems to work fine when wrapped around a matrix, but that forces me out of the align enviroment.
Here is an example of what I am trying to do, but the aboxed code is what is triggering the error if you try to compile it.
\documentclass{article}
\usepackage{color}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{braket}
\usepackage{cancel}
\hypersetup{
colorlinks=true,
linkcolor=blue,
urlcolor=blue
}
\begin{document}
\begin{equation}
\boxed{ \rho^{(z)}
=
\begin{pmatrix}
1 & 0 \\
0 & 0
\end{pmatrix}}
\end{equation}
\begin{align}
\Aboxed{ \rho^{(z)}
&=
\begin{pmatrix}
1 & 0 \\
0 & 0
\end{pmatrix}}
\end{align}
\end{document}

pmatrixin the\Aboxedversion in a pair of braces{ }. The\Aboxedmacro works by scanning its argument for&, the{ }hide those from it. – Qrrbrbirlbel May 20 '13 at 00:46\@char asking to convert it to an answer @Qrrbrbirlbel – percusse May 20 '13 at 12:12