[Tex/LaTex] Numbering commutative diagrams

commutative-diagramsnumberingtikz-cd

Is there a nice way to number commutative diagrams (like equations) ? When using tikz-cd I put a figure environment around it, and then there is no number anywhere. I can also use

\begin{align}
\xymatrix{Some diagram}
\end{align}

but then the number is not placed nicely corresponding to the middle of the diagram.

Best Answer

I'm not sure why you think you need a figure environment to use a tikzcd environment, that is not the case. In fact, one of the first things written in the introduction of the tikz-cd manual is

Everything inside {tikzcd} is typeset in math mode, but you will probably want to use it inside an {equation} environment or \[ ... \], so that the diagram is placed on a new line and centered.

Hence, using a random example from the manual:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\begin{document}
\begin{equation}
\begin{tikzcd}
A \arrow{d} \arrow{r}[near start]{\phi}[near end]{\psi}
& B \arrow[red]{d}{\xi} \\
C \arrow[red]{r}[blue]{\eta}
& D
\end{tikzcd}
\end{equation}
\end{document}

enter image description here

Related Question