# Isomorphisms in commutative diagrams in TikZ

Sorry for the basic question. I am trying to get commutative diagrams like

\usepackage{tikz}
\usetikzlibrary{matrix,arrows}
$$\begin{tikzpicture}[description/.style={fill=white,inner sep=2pt}] \matrix (m) [matrix of math nodes, row sep=3em, column sep=2.5em, text height=1.5ex, text depth=0.25ex] {A & B \\ C& D \\ }; \path[->,font=\scriptsize] (m-1-1) edge node[auto] {\widetilde {f} } (m-1-2) (m-2-1) edge node[auto] { f } (m-2-2); \draw[double equal sign distance,shorten <=5pt,shorten >=5pt] (m-1-2) -- (m-2-2); \draw[double equal sign distance,shorten <=5pt,shorten >=5pt] (m-1-1) -- (m-2-1); \end{tikzpicture}$$


My question is: How do I replace the vertical equal sign connecting $A$ to $C$ with a vertical isomorphism sign, a vertical version of $\simeq$ or $\approx$?

-
possible duplicate: [tex.stackexchange.com/questions/43641/covering-map-arrow/… –  cmhughes Feb 13 '12 at 16:56
Sort of vaguely related: tex.stackexchange.com/q/15830/86 –  Andrew Stacey Feb 13 '12 at 17:31

I tried to modifiy your code, but it only resulted in weird shifting and not the desired result at all. As an OCD like control freak, I always position "by hand", so tell me if this works for you:

\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{matrix,arrows}

\begin{document}

\begin{tikzpicture}
\node (A) at (0,0) {A};
\node (B) at (2,0) {B};
\node (C) at (0,-2) {C};
\node (D) at (2,-2) {D};
\draw (A) edge node[above] {$\widetilde {f}$} (B);
\draw (C) edge node[above] {$f$} (D);
\draw (A) edge node[above,rotate=90] {$\simeq$} (C);
\draw (B) edge node[above,rotate=90] {$\approx$} (D);
\end{tikzpicture}

\end{document}


Edit 1: With some "cheated" changes as wh1te proposed:

\draw[white] (A) edge node[rotate=90,black] {$\simeq$} (C);
\draw[white] (B) edge node[rotate=90,black] {$\approx$} (D);


Edit 2: Of cause, one would still see the lines on a non-white background, so this should be better:

\draw[transparent] (A) edge node[rotate=90,opacity=1] {$\simeq$} (C);
\draw[transparent] (B) edge node[rotate=90,opacity=1] {$\approx$} (D);


Edit 3: I could not think of any automated way right now, but you could use a \resizebox:

\draw[transparent] (A) edge node[rotate=90,opacity=1] {\resizebox{1.5cm}{0.3cm}{$\simeq$}} (C);
\draw[transparent] (B) edge node[rotate=90,opacity=1] {\resizebox{1.5cm}{0.3cm}{$\approx$}} (D);


-
My understanding was that he wanted the actual line connecting the two nodes to be like that symbol, not just label the existing line. So a snake decoration could probably be used to do the job. –  Roelof Spijker Feb 13 '12 at 16:06
Thank you for the response Tom. I am happy to learn of how to do this too. But I was preferring as whlt3 suggested, to be able to make the whole line connecting the two nodes as the isomorphism sign –  clh Feb 13 '12 at 16:12
This is almost what I had in mind, but can you make the isomorphism signs fill the space between the nodes more, like the double equals sign does in my example. –  clh Feb 13 '12 at 16:17
Great, thank you! –  clh Feb 13 '12 at 19:06
Possible instead of resizebox :  \path (C) -- node[sloped,transform shape,inner sep=0pt,xscale=6] {$\simeq$} (A) ;  –  Alain Matthes Feb 13 '12 at 21:52
show 4 more comments