TikZ CD – How to Rotate an Arrow Label

rotatingtikz-arrowstikz-cd

I have a commutative diagram with a vertical isomorphism, and am currently using a Tilde a one of its labels.

\ar[d, "\sim"', "\phi^1"]

The intent would be clearer if I rotated the Tilde 90 degrees. Is there an easy way to do that in tikz-cd without rotating the other label?

Best Answer

You can apply styles to labels in tikz-cd. Usually they would be like "\sim" draw, while with multiple options, they would need to be enclosed by braces. However, I'm inexplicably getting an error in that case. So I worked around the problem using \tikzset styles.

Output

enter image description here

Code

\documentclass[margin=10pt]{standalone}
\usepackage{tikz-cd}

\tikzset{
    labl/.style={anchor=south, rotate=90, inner sep=.5mm}
}

\begin{document}
\begin{tikzcd}
a \ar[d, "\sim" labl, "\phi^1"] \\
b 
\end{tikzcd}
\end{document}