# Adding arrow between two parts of tikzcd diagram

I have the following tikzcd diagram, where I am trying to create an a line between the nodes B and A/I.

I tried using two phantom nodes and join an arrow between them, but nothing shows up except a dot where the arrow is supposed to be.

(Also, the thickness of the line adjoining C and I is thicker than C/I to 0 for some reason)

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

\begin{document}
\begin{tikzcd}[column sep=0em,row sep=1em]
&R\arrow[dl,dash]\arrow[dr,dash] &&&&& R/I\arrow[dl,dash]\arrow[dr,dash]\\
A\arrow[dr,dash] && B\arrow[dl,dash]  &\phantom{X}\arrow[r,dash]&\phantom{Y}& A/I\arrow[dr,dash] && B/I\arrow[dl,dash]\\
&C\arrow[d,dash] &&&&& C/I\arrow[d,dash]\\
&I &&&&& 0
\end{tikzcd}
\end{document}


The goal is to create this diagram:

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

\begin{document}
\begin{tikzcd}[column sep=0em,row sep=1em]
&R\arrow[dl,dash]\arrow[dr,dash] &&&&& R/I\arrow[dl,dash]\arrow[dr,dash]\\
A\arrow[dr,dash] && B\arrow[dl,dash] \arrow[rrr, leftrightarrow] % This is the new bit
&\phantom{X}\arrow[r,dash]&\phantom{Y}& A/I\arrow[dr,dash] && B/I\arrow[dl,dash]\\
&C\arrow[d,dash] &&&&& C/I\arrow[d,dash]\\
&I &&&&& 0
\end{tikzcd}
\end{document}


Just add \arrow[rrr, leftrightarrow] to get an arrow spanning three columns that points left and right. As for the extra thickness in one line it seems like the sort of issue that is PDF reader dependent, try looking at the document in a different PDF reader.

• Thanks, I didn’t know that was how the direction option worked! Mar 7, 2021 at 13:12
• No problem, I actually only learnt how tikzcd works myself when I needed it a few days ago Mar 7, 2021 at 13:13

One more, to my opinion more simple, solution with drawing two separate (simple) commutative diagrams connected by \longleftrightarrow:

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

\begin{document}
$\tikzcdset{ arrows = dash, column sep/normal = 1em, every matrix/.append style = {name=m}, } \begin{tikzcd}[baseline=(m-2-3.base)] & R \ar[dl]\ar[dr] & \\ A \ar[dr] & & B \ar[dl] \\ & C \ar[d] & \\ & I & \end{tikzcd} \longleftrightarrow \begin{tikzcd}[baseline=(m-2-3.base)] & R/I \ar[dl]\ar[dr] & \\ A/I \ar[dr] & & B/I \ar[dl] \\ & C/I \ar[d] & \\ & O & \end{tikzcd}$
\end{document}


Or with drawing arrow between diagrams:

\documentclass{article}
\usepackage{tikz-cd}
\usetikzlibrary{arrows.meta}

\begin{document}
$\tikzcdset{ arrows = dash, column sep/normal = 1em, every matrix/.append style = {name=m}, } \begin{tikzcd}[baseline=(m-2-3.base)] & R \ar[dl]\ar[dr] & \\ A \ar[dr] & & B \ar[dl] \\ & C \ar[d] & \\ & I & \end{tikzcd} \tikz[>={Straight Barb[scale=1.2]}, baseline=-0.8ex] \draw[<->] (0,0) -- (1.5,0); \begin{tikzcd}[baseline=(m-2-3.base)] & R/I \ar[dl]\ar[dr] & \\ A/I \ar[dr] & & B/I \ar[dl] \\ & C/I \ar[d] & \\ & O & \end{tikzcd}$
\end{document}


Edit: O is replaced by 0, default column width is reduced to 1em

• I tried this solution before but the centers weren’t lining up. Now I know about the baseline option, thanks! Mar 7, 2021 at 13:50
• @Hushus46, tikz-cd is based on tikz package (as name of package implies), so you can use options and commands defined in it. baseline option is primarily used at aligning inline tikzpictures or two pictures as is in your case. To my opinion my solution is simpler and therefore less prone to error. I would stik with it :-) Mar 7, 2021 at 14:06
• Yea, I read through the tikzcd documentation but this is the first time I’m using tikz or related so I didn’t know that. Is there any way to make the diamonds taller than they are wide? Kind of like my photo of the intended diagram Mar 7, 2021 at 14:09
• @H, see edited answer which gives global solution (you can select even shorter separation), however you can define column sep locally for example by column sep=small (see tick-cd documentation, pp 6). So far I didn't bother with this problem :-(. Mar 7, 2021 at 14:22