# Equation Labeling and xypic

Suppose I have the following TeX code for a diagram using xymatrix:

\begin{align}\label{diagram}
\xymatrix{
C\ar[r] & D &\\
B\ar[u] &   & \\
A\ar[u] &   &}
\end{align}


This creates a diagram with the equation label lining up with the first row, so it looks something like "C -> D (1)". How do I get it to line up with the B so that the equation label is aligned with the vertical center of the diagram?

## 1 Answer

The simplest trick for having an \xymatrix centered with respect to the equation number is to enclose it into a gathered environment.

$$\label{diagram} \begin{gathered} \xymatrix{ C\ar[r] & D &\\ B\ar[u] & & \\ A\ar[u] & &} \end{gathered}$$


Don't use align for single equations (or, in general, single objects): the spacing comes out wrong.