This is follow-up on the similar question.
I still cannot figure out where to put ampersands on alignat
environments. :(
Here is what I generated.
To enhace the readability, I want to customize the alignment.
- I'd like the second column to be aligned around
\oplus
even though it induces some spaces after the first=
sign and before the second=
sign. - Similarly, I'd like the third column to be aligned around
+
sign even though it induces some space after the=
signs. - Yet, I'd like the three columns to be separated by the
=
signs that are vertically aligned as shown above.
How can I do that?
\documentclass{minimal}
\usepackage{amsmath,amssymb,bm}
% Matrix inverse \inv[2]{\Abf} or \inv{\Abf}
\newcommand{\inv}[2][1]{\ensuremath{{#2}^{-{#1}}}}
% Matrix transpose
\newcommand{\trans}[1]{\ensuremath{{#1}^\intercal}}
\newcommand{\Abf}{\ensuremath{\bm{A}}}
\newcommand{\Ibf}{\ensuremath{\bm{I}}}
\newcommand{\Pbf}{\ensuremath{\bm{P}}}
\newcommand{\Qbf}{\ensuremath{\bm{Q}}}
\newcommand{\Ubf}{\ensuremath{\bm{U}}}
\begin{document}
\begin{subequations}
\begin{alignat}{3}
\lambda\Ibf - \Abf
&=
\Ubf
\big(
(\lambda-n)\Ibf_{k-1}
&\oplus
\lambda\Ibf_{n-k+1}
\big)
\trans\Ubf
&=
(\lambda-n)\Pbf + \lambda\Qbf
\\
\inv{(\lambda\Ibf - \Abf)}
&=
\Ubf
\Bigg(
\frac{1}{\lambda-n}\Ibf_{k-1}
&\oplus
{\frac 1 \lambda}\Ibf_{n-k+1}
\Bigg)
\trans\Ubf
&=
{\frac 1 {(\lambda-n)}}\Pbf + {\frac 1 \lambda}\Qbf
\\
\inv[2]{(\lambda\Ibf - \Abf)}
&=
\Ubf
\Bigg(
\frac{1}{(\lambda-n)^2}\Ibf_{k-1}
&\oplus
{\frac 1 {\lambda^2}}\Ibf_{n-k+1}
\Bigg)
\trans\Ubf
&=
{\frac 1 {(\lambda-n)^2}}\Pbf + {\frac 1 {\lambda^2}}\Qbf
\end{alignat}
\end{subequations}
\end{document}