0

I have a commutative diagram created using tikz-cd. I have always used the baseline optional argument to get punctuation to follow the diagram in a reasonable way. However, I now want to give the diagram an equation number, and I've just discovered that it misplaces the number! How can we have have Tikz use different baselines for these two purposes?

example

\documentclass[preview]{standalone}
\usepackage{tikz-cd}
\begin{document}

How I normally use the baseline.  To get the punctation to follow the diagram, I do    
\[
\begin{tikzcd}[baseline=(W.base)]
  X \ar[d] \ar[r] & Y \ar[d] \\   
  Z \ar[r] & |[alias=W]| W
\end{tikzcd}.
\]   

But now if I want to number the diagram as well, I get 
\begin{equation}
\begin{tikzcd}[baseline=(W.base)]
  X \ar[d] \ar[r] & Y \ar[d] \\   
  Z \ar[r] & |[alias=W]| W
\end{tikzcd}.
\end{equation}
But I want the equation number positioned as in
\begin{equation}
\begin{tikzcd}
  X \ar[d] \ar[r] & Y \ar[d] \\   
  Z \ar[r] & |[alias=W]| W
\end{tikzcd}.
\end{equation}

\end{document}

One note, I would like this to work in amsart, which does some things to the positioning of equation numbers.

  • I normally ass the period inside the diagram, as in W \rlap{\ .}, using \rlap such that the space and the period does not affect the alignment of the W, and then drop the baseline – daleif Apr 23 '18 at 9:36
  • Well, you might incorporate the full stop to the diagram , but honestly, I think that for a diagram, it would be better-looking without a full stop. – Bernard Apr 23 '18 at 9:37
  • @daleif This is exactly the reason I resorted to the baseline change in the first place... so I think you've solved my problem. – Corey Harris Apr 23 '18 at 9:52
  • You can integrate the dot inside the diagram by replacing alias=W with label=right:.. – Kpym Apr 23 '18 at 9:54
1

Often a diagram like this is seen as a graphics and as Bernard argued in a comment, a period might not be needed (I might end the preceding sentence with a colon).

Otherwise I normally just use

W \rlap{ .} 

in the last entry in the diagram to add something after the W in a manner that does not affect the alignment in the diagram.

There are probably even better solutions in the plethora of options inside tikz/tikz-cd

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.