[Tex/LaTex] How to align matrices on top of each other

alignmatrices

Suppose I have the following situation (don't mind the notations, it's ring theory):

Ugly matrices.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
    \newcommand{\mymatrix}{\begin{bmatrix}  1 &1\\0& 0  \end{bmatrix}}
    \begin{align*}
    \begin{bmatrix} a&b\\c&d    \end{bmatrix}\mymatrix&=\begin{bmatrix} a&a\\c&c    \end{bmatrix}\in Rx\\[\parskip]
    \text{and}\qquad\mymatrix\begin{bmatrix} a'&b'\\c'&d'   \end{bmatrix}&=\begin{bmatrix} a'+c'&b'+d'\\0&0 \end{bmatrix} \in xR.
    \end{align*}
\end{document}

It's clear that the brackets are now all over the place. How can I align the matrices on the left hand side two-by-two on top of each other? I suppose one could give them all the same width, but I don't know how to do that.

Best Answer

Caution: I have no idea what \in Rx means (x\in\mathbb{R}) perhaps?

Here's an alignat* version, using some additional & to align the several matrices and = signs:

\documentclass{article}
\usepackage{mathtools}

\begin{document}
    \newcommand{\mymatrix}{\begin{bmatrix}  1 &1\\0& 0  \end{bmatrix}}
    \begin{alignat*}{3}
    \begin{bmatrix} a&b \\ c&d    \end{bmatrix} & \mymatrix                                &=&\begin{bmatrix} a&a\\c&c    \end{bmatrix}\in Rx \\[\parskip]
    \intertext{and}\mymatrix                 & \begin{bmatrix} a'&b'\\c'&d'   \end{bmatrix}&=&\begin{bmatrix} a'+c'&b'+d'\\0&0 \end{bmatrix} \in xR.
    \end{alignat*}

   \begin{alignat*}{3}
    \begin{bmatrix} a&b \\ c&d    \end{bmatrix} & \mymatrix                                &=&\begin{bmatrix} a&a\\c&c       \end{bmatrix}\in Rx \\[\parskip]
   \shortintertext{and}\mymatrix                 & \begin{bmatrix}  a'&b'\\c'&d'   \end{bmatrix}&=&\begin{bmatrix} a'+c'&b'+d'\\0&0 \end{bmatrix} \in xR.
\end{alignat*}
\end{document}

I suggest to use \intertext{and} instead of \text{and}\qquad... (or even better, use \shortintertext (thanks to @Zarko who recommended) this.)

Here's the output:

enter image description here

Related Question