# Subequation aligning using matrix

When I use multiple matrix equations in subequation, I am doing it as in the code snippet. However, when I want to align the equations with respect to equal sign, = (commented in the code), I am having errors during pdftexing.

Is there an alternative way to align the subequations?

\begin{subequations}
%\begin{align}
\begin{equation} \label{eq:model_m}
[M] =
\begin{bmatrix}
m_{1} & 0 & 0 \\
0 & m_{2} & 0 \\
0 & 0 & m_{3} \\
\end{bmatrix}
\end{equation}
\begin{equation} \label{eq:model_c}
[C] =
\begin{bmatrix}
c_{1} + c_{2} & -c_{2} & 0\\
-c_{2} & c_{2}+ c_{3} & -c_{3}\\
0 & -c_{3} & c_{3} \\
\end{bmatrix} \\
\end{equation}
%\end{align}
\end{subequations}


A minimal example would be (thanks to suggestion from Svend Tveskæg):

\documentclass[]{report}   % list options between brackets
\usepackage{amsmath} %contains the advanced math extensions for LaTeX

\begin{document}

\begin{subequations}
%\begin{align}
\begin{equation} \label{eq:model_m}
[X] =
\begin{bmatrix}
a & 0 \\
0 & b \\
\end{bmatrix}
\end{equation}
\begin{equation} \label{eq:model_c}
[Y] =
\begin{bmatrix}
c+e & 0\\
0 & d+f
\end{bmatrix}
\end{equation}
%\end{align}
\end{subequations}

\end{document}


Edit: For reference, I am using MiKTeX and TeXstudio on Windows 7, if it matters.

You can't use equation within align, so just remove all those, add & before the equals signs, and add a line break (\\) at the end of the first line (after the matrix) and this works just fine.

\documentclass[]{report}   % list options between brackets
\usepackage{amsmath} %contains the advanced math extensions for LaTeX

\begin{document}

\begin{subequations}
\begin{align}
\label{eq:model_m}
[X] &=
\begin{bmatrix}
a & 0 \\
0 & b \\
\end{bmatrix} \\
\label{eq:model_c}
[Y] &=
\begin{bmatrix}
c+e & 0\\
0 & d+f
\end{bmatrix}
\end{align}
\end{subequations}

\end{document}

• didn't know it could be that easy. what does & sign do specifically for this case? – Ali Oct 2 '13 at 11:28
• @Ali The & defines the alignment point. align doesn't magically know where you want to align things, so you define that by adding & just before the equals sign. See e.g. amsmaths manual. – Torbjørn T. Oct 2 '13 at 11:32

You don't need equation environment inside align. Align already contains the capabilities.

\documentclass[]{report}   % list options between brackets
\usepackage{mathtools} %Fixes/improves amsmath

\begin{document}

\begin{subequations}\label{eq:all}
\begin{align}
\label{eq:model_m}
[X] &=
\begin{bmatrix}
a & 0 \\
0 & b \\
\end{bmatrix}\\
\label{eq:model_c}
[Y] &=
\begin{bmatrix}
c+e & 0\\
0 & d+f
\end{bmatrix}
%\end{equation}
\end{align}
\end{subequations}
Some \eqref{eq:all},\eqref{eq:model_c},\eqref{eq:model_m}
\end{document} 