# Move equation label underneath diagram/equation with tikzd

I'm doing a lot of equations with tikzcd, and for some bigger equations I want the equation number labet to be on the bottom of the diagram. Is there any way to achieve this without manipulating the width of the diagram?

I apologize in advance for the stupid example :-)

$$\begin{tikzcd} A \arrow[r] & B \arrow[d]\arrow[r] & B \arrow[d]\arrow[r] & B \arrow[d]\arrow[r] & B \arrow[d] \arrow[r]& B \arrow[d] \arrow[r] & B \arrow[d] \arrow[r]& B \arrow[d] \\ D \arrow[u] & C \arrow[l] & C \arrow[l] & C \arrow[l] & C \arrow[l] & C \arrow[l] & C \arrow[l] & C \arrow[l] \end{tikzcd}$$


amsmath will lower the equation number when the display is too wide. You can make it artificially too wide by using a box.

However, you need ampersand replacement, because & only works when the tikzcd environment is not in the argument to a command.

\documentclass{article}
\usepackage{amsmath,tikz-cd}

\usepackage{lipsum}

\begin{document}

\lipsum[1][1-4]
$$\makebox[\displaywidth]{% \begin{tikzcd}[ampersand replacement=\&] A \arrow[r] \& B \arrow[d]\arrow[r] \& B \arrow[d]\arrow[r] \& B \arrow[d]\arrow[r] \& B \arrow[d] \arrow[r]\& B \arrow[d] \arrow[r] \& B \arrow[d] \arrow[r]\& B \arrow[d] \\ D \arrow[u] \& C \arrow[l] \& C \arrow[l] \& C \arrow[l] \& C \arrow[l] \& C \arrow[l] \& C \arrow[l] \& C \arrow[l] \end{tikzcd}% }$$
\lipsum[1][1-4]

\end{document}


On the other hand, it's hard to find a reason for this strange placement.

Since I do not have the embedding document, I need to guess.

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\begin{document}
\begin{multline}
\begin{tikzcd}[ampersand replacement=\&]
A \arrow[r] \& B \arrow[d]\arrow[r] \& B \arrow[d]\arrow[r]  \& B \arrow[d]\arrow[r]  \& B \arrow[d] \arrow[r]\& B \arrow[d] \arrow[r] \& B \arrow[d] \arrow[r]\& B \arrow[d]       \\
D \arrow[u] \& C \arrow[l] \& C \arrow[l] \& C \arrow[l] \& C \arrow[l] \& C \arrow[l] \& C \arrow[l] \& C \arrow[l]
\end{tikzcd}\\
\end{multline}
\end{document}

• Using multiline with the \end{tikzcd}\\ does place the label in the correct place, but it misaligns the equation. Instead of being centered it is left aligned. Also, why do you use [ampersand replacement=\&]? May 17 at 19:23
• @nancytrain You can also use \begin{align} \begin{tikzcd}[ampersand replacement=\&] ... \end{tikzcd}\notag \\ \end{align}. I use ampersand replacement to distinguish the ampersands in the tikzcd matrix from the ones in the amsmath environment because otherwise they can lead to confusion or errors.
– user242026
May 17 at 19:31
• That does work, even though it looks like black magic. Is there any way to put [ampersand replacement=\&] on the align so I don't need to replace & in all my equations? May 17 at 19:52
• @nancytrain No, as far as I know there is no easy way to install an ampersand replacement for amsmath environments.
– user242026
May 17 at 19:56