[Tex/LaTex] Two matrices side by side

amsmathhorizontal alignmentmatrices

I'm trying to typeset two matrices side by side, somewhat like:

A = (matrix)    B = (matrix)

I tried to next the matrices inside an align environment:

\begin{align*}
  A &= \begin{pmatrix} ... \end{pmatrix} &
  B &= \begin{pmatrix} ... \end{pmatrix}
\end{align*}

but I get when compiling:

Package amsmath Error: Erroneous nesting of equation structures

Presumably the way I'm trying to do it isn't the right way; how should I be doing this?

Best Answer

The error has been caused by accidentally nesting align* and equation, as Ben informed.

Displayed math environments cannot be nested. However, there are environments such as aligned and split which work inside an equation environment.

This answer has been posted and marked as community wiki, in the hope that after an upvote this question isn't marked as "unanswered" by the site any more.