1

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.

  • 2
    wrap it in a gathered env. I would not use figure for a tikzcd env, it is a math construction and should thus have a math eq number. – daleif May 20 '16 at 13:19
  • 2
    You can put a tikzcd environment in an equation. – Torbjørn T. May 20 '16 at 13:19
  • 3
    Just for the record: don't use align for single line displays (and \xymatrix counts for a single line). – egreg May 20 '16 at 13:23
  • the number in a figure environment comes from \caption{...} so if you add some text for the diagram in \caption it will b enumbered – David Carlisle May 20 '16 at 13:24
  • 1
    Do you want them to share numbers with equations, or have their own set of numbers? – Steven B. Segletes May 20 '16 at 13:43
1

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

1

This is in response to the OP's request to be ale to designate a different set of numbers and label style to commutative diagrams.

It uses my numberedblock package that was intended to numbering code blocks, but used here for commutative diagrams. It has a labeling/referencing system, and the tag location and appearance can be customized.

Unfortunately, this solution is a little inconvenient, because I cannot stick the tikzcd environment in directly as the argument to a \numblock. SO I have to put it first in a temporary box and then apply the \numblock to the box.

\documentclass{article}
\usepackage{tikz-cd}
\usepackage{numberedblock,lipsum}
\setlength\blockindent{0in}
\begin{document}
\lipsum[1]

\setbox0=\hbox{\begin{tikzcd}
R \arrow{r}{\phi} \arrow[swap]{d}{\chi} & S \arrow{d}{\Psi} \\
R/I \arrow{ur}{\psi} \arrow{r}{\Phi} & T
\end{tikzcd}}
\numblock{\nblabel{cdA}\makebox[\textwidth]{\box0}}

\lipsum[4]

\setbox0=\hbox{\begin{tikzcd}
R \arrow{r}{\phi} \arrow[swap]{d}{\chi} & S \arrow{d}{\Psi} \\
blah blah R/I \arrow{ur}{\psi} \arrow{r}{\Phi} & T (blah-blah wider)
\end{tikzcd}}
\numblock{\nblabel{cdB}\makebox[\textwidth]{\box0}}

In commutative diagrams \ref{cdA} and \ref{cdB}, we see\ldots
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.