我正在尝试绘制蛇形引理图,但连接态射没有像我希望的那样从其他态射下方通过(它确实从下方通过,但间距不够,第二张图应该能清楚地说明我的意思),而且我也想移动它的标签,就像第二张图一样。
\[\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}\]
答案1
你需要找到一种方法来告诉 tikzcd,f、f'、f'' 带有白色背景。例如
\def\atfield[#1]{\arrow[#1,nodes={fill=white}]}
您还可以使用它preaction={draw=white,-,line width=3}
来为箭头创建白色背景。
\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}
答案2
这不使用tikz-cd
,但基于给出的答案如何绘制蛇形引理中连接同态的“蛇”形箭头?。间隙的大小部分是硬编码的,因为它们必须包含节点和边缘。我还没有将其调整到您的标签,但这应该是直截了当的(我建议使用节点,asymmetrical rectangle
以便alpha
和beta
标签水平对齐)。
\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}