[Tex/LaTex] Subequation aligning using matrix

alignequationsmatricessubequations

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.

Best Answer

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}
Related Question