1

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)

enter image description here

\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: enter image description here

Hushus46
  • 211

2 Answers2

2

the requested commutative 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.

Willoughby
  • 3,649
1

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}

enter image description here

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}

enter image description here

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

Zarko
  • 296,517
  • I tried this solution before but the centers weren’t lining up. Now I know about the baseline option, thanks! – Hushus46 Mar 07 '21 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 :-) – Zarko Mar 07 '21 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 – Hushus46 Mar 07 '21 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 :-(. – Zarko Mar 07 '21 at 14:22