1

i'm trying to draw the snake-lemma diagram but the connective morphism is no passing under the other ones as i would like to (it IS passing under, but not with enough spacing, the second image should clarify what i mean) and i would also like to move its label, like the second figure.

Snake-lemma

Snake-lemma how i want it

\[\begin{tikzcd}
{} & \red{\ker f'} \arrow[r, "\overline{\alpha}", red] \arrow[d, hook, "i'"] & \red{\ker f} \arrow[r, "\overline{\beta}", red] \arrow[d, hook, "i"] & \red{\ker f''} \arrow[d, hook, "i''"] 
\arrow[ddd, phantom, ""{coordinate, name=Z}] \arrow[dddll,
    "\delta",
    rounded corners,
    to path={ -- ([xshift=2ex]\tikztostart.east)
              |- (Z) [near end]\tikztonodes
              -| ([xshift=-2ex]\tikztotarget.west)
              -- (\tikztotarget)}, red] & {}\\
{} & M' \arrow[r, "\alpha"] \arrow[d, "f'"] & M \arrow[r, "\beta"] \arrow[d, "f"] & M'' \arrow[r] \arrow[d, "f''"] & 0 \\
0 \arrow[r] & N' \arrow[r, "\alpha'"] \arrow[d, two heads, "\pi'"] & N \arrow[r, "\beta'"] \arrow[d, two heads, "\pi"] & N'' \arrow[d, two heads, "\pi''"] & {} \\
{} & \red{\coker f'} \arrow[r, "\overline{\alpha'}", red] & \red{\coker f} \arrow[r, "\overline{\beta'}", red] & \red{\coker f''} & {}
\end{tikzcd}\]

2 Answers2

4

You need to find a way to tell tikzcd that f, f', f'' come with white backgrounds. For instance \def\atfield[#1]{\arrow[#1,nodes={fill=white}]}

You may also use preaction={draw=white,-,line width=3} to create white background for arrows.

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

\def\red#1{|[red]|#1} \def\coker{\operatorname{coker}} \def\atfield[#1]{\arrow[#1,preaction={draw=white,-,line width=3},nodes={fill=white}]}

[\begin{tikzcd} {} & \red{\ker f'} \arrow[r, "\overline{\alpha}", red] \arrow[d, hook, "i'"] & \red{\ker f} \arrow[r, "\overline{\beta}", red] \arrow[d, hook, "i"] & \red{\ker f''} \arrow[d, hook, "i''"] \arrow[ddd, phantom, ""{coordinate, name=Z}] \arrow[dddll, "\qquad\delta", rounded corners, to path={ -- ([xshift=2ex]\tikztostart.east) |- (Z) [near end]\tikztonodes -| ([xshift=-2ex]\tikztotarget.west) -- (\tikztotarget)}, red] & {}\ {} & M' \arrow[r, "\alpha"] \atfield[d, "f'"] & M \arrow[r, "\beta"] \atfield[d, "f"] & M'' \arrow[r] \atfield[d, "f''"] & 0 \ 0 \arrow[r] & N' \arrow[r, "\alpha'"] \arrow[d, two heads, "\pi'"] & N \arrow[r, "\beta'"] \arrow[d, two heads, "\pi"] & N'' \arrow[d, two heads, "\pi''"] & {} \ {} & \red{\coker f'} \arrow[r, "\overline{\alpha'}", red] & \red{\coker f} \arrow[r, "\overline{\beta'}", red] & \red{\coker f''} & {} \end{tikzcd}]

\end{document}

Symbol 1
  • 36,855
1

This doesn't use tikz-cd but is based on the answer given at How do you draw the "snake" arrow for the connecting homomorphism in the snake lemma? . The sizes of the gaps are partly hard coded as they have to encompass both the node and the edge. I haven't adapted it to your labels, but that should be straight forward (I recommend using the asymmetrical rectangle node so that the alpha and beta labels are aligned horizontally).

\documentclass[border=10]{standalone}
%\url{https://tex.stackexchange.com/q/611629/86}
\thispagestyle{empty}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{tikz-cd}
\usetikzlibrary{%
  matrix,%
  calc,%
  arrows%
}

\DeclareMathOperator{\coker}{coker}

\begin{document} \begin{tikzpicture}[>=triangle 60] \matrix[matrix of math nodes,column sep={60pt,between origins},row sep={60pt,between origins},nodes={asymmetrical rectangle}] (s) { &|[name=ka]| \ker f &|[name=kb]| \ker g &|[name=kc]| \ker h \ % &|[name=A]| A' &|[name=B]| B' &|[name=C]| C' &|[name=01]| 0 \ % |[name=02]| 0 &|[name=A']| A &|[name=B']| B &|[name=C']| C \ % &|[name=ca]| \coker f &|[name=cb]| \coker g &|[name=cc]| \coker h \ }; \draw[->] (ka) edge (A) (kb) edge (B) (kc) edge (C) (A) edge (B) (B) edge node[auto] {(p)} (C) (C) edge (01) (A) edge node[auto,asymmetrical rectangle] (f) {(f)} (A') (B) edge node[auto,asymmetrical rectangle] (g) {(g)} (B') (C) edge node[auto,asymmetrical rectangle] (h) {(h)} (C') (02) edge (A') (A') edge node[auto] {(i)} (B') (B') edge (C') (A') edge (ca) (B') edge (cb) (C') edge (cc) ; \draw[->,gray] (ka) edge (kb) (kb) edge (kc) (ca) edge (cb) (cb) edge (cc) ; \draw[->,gray,rounded corners] (kc) -| node[auto,text=black,pos=.7] {(\partial)} ($(01.east)+(.5,0)$) |- (h.mid east) (h.mid west) +(-.1,0) -- (g.mid east) (g.mid west) +(-.1,0) -- (f.mid east) (f.mid west) +(-.1,0) -| ($(02.west)+(-.5,0)$) |- (ca);

\end{tikzpicture} \end{document}

snake lemma with gaps

Andrew Stacey
  • 153,724
  • 43
  • 389
  • 751