When I put an equation in align environment into a subfigure, it breaks figure numbering. In the example below, the whole figure gets number 2, not 1 as I want.

How do I fix it?

% array* or flalign or similar here breaks numbering
a& = b \\
c& = d
\caption{\label{fig:toffoli}Toffoli gate.}

The example can be viewed at https://www.writelatex.com/read/xkhkknjnfvdq .

1 Answer 1


You can solve this by using

\[ \begin{aligned}
     %your equations
\end{aligned} \]

Here is a slight modification of your example: https://www.writelatex.com/read/gtnsxqnpkdtr

  • I'd use $\begin{aligned}...\end{aligned}$: the centering is already provided.
    – egreg
    Commented Nov 16, 2013 at 18:00
  • Dear egreg, you are absolutely right. But maybe it would be even better to remove the \centering, and use the \[ %stuff \] to obtain normal displaymath. Don't you think so?
    – jmc
    Commented Nov 16, 2013 at 18:02
  • 2
    I'm not sure I would: \[ can be dangerous when used first in a box. However, subfigure is a minipage under cover, so maybe it could work. I usually upvote questions I answer to (unless they are really unworthy).
    – egreg
    Commented Nov 16, 2013 at 18:04
  • Dear egreg, thanks for that bit of information. I did not know that!
    – jmc
    Commented Nov 16, 2013 at 18:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .