下面的代码
\[
\begin{tikzpicture}[>=latex]
\def\radius{3cm} % change to an appropriate value
\node (h0A) at (60:\radius) {$H^0(G,A)$};
\node (h0C) at (0:\radius) {$H^0(G,C)$};
\node (h1B) at (-60:\radius) {$H^1(G,B)$};
\node (h1A) at (-120:\radius) {$H^1(G,A)$};
\node (h1C) at (180:\radius) {$H^1(G,C)$};
\node (h0B) at (120:\radius) {$H^0(G,B)$};
\path[->,font=\small]
(h0A) edge node[auto] {$g_0$} (h0C)
(h0C) edge node[auto] {$\delta_0$} (h1B)
(h1B) edge node[auto] {$f_1$} (h1A)
(h1A) edge node[auto] {$g_1$} (h1C)
(h1C) edge node[auto] {$\delta_1$} (h0B)
(h0B) edge node[auto] {$f_0$} (h0A);
\end{tikzpicture}\]
但我想交换$A$
和$B$
并写出下图。
但是当我交换上图中的$A$
和时,图表被破坏了。 我该如何在 LaTeX 中写出下面的图表?$B$
答案1
(评论太长,因此作为答案发布;已更新以包含@JasperHabicht 的建议)
当我将节点列表中的字母序列 ACBACB 替换为 BCABCA 时,并没有发现“图表被破坏”。
请注意,没有必要以类似的方式更新六个节点名称。事实上,给节点贴上标签可能是个好主意无参考到其内容。例如,可以选择u
、v
、w
、x
、y
和z
作为六个节点名称。
\documentclass{article}
\usepackage{tikz,amssymb}
\begin{document}
\[
\begin{tikzpicture}[>=latex]
\def\radius{3.3cm} % choose an appropriate value
\node (u) at ( 60:\radius) {$H^0(G,B)$};
\node (v) at ( 0:\radius) {$H^0(G,C)$};
\node (w) at (300:\radius) {$H^1(G,A)$};
\node (x) at (240:\radius) {$H^1(G,B)$};
\node (y) at (180:\radius) {$H^1(G,C)$};
\node (z) at (120:\radius) {$H^0(G,A)$};
\path[->]
(u) edge node[auto] {$g_0$} (v)
(v) edge node[auto] {$\delta_0$} (w)
(w) edge node[auto] {$f_1$} (x)
(x) edge node[auto] {$g_1$} (y)
(y) edge node[auto] {$\delta_1$} (z)
(z) edge node[auto] {$f_0$} (u);
\node[rotate=180] at (0,0) {\Huge$\circlearrowright$};
\end{tikzpicture}
\]
\end{document}
答案2
这是 的工作tikz-cd
。
我没有使用,因为它的尖端与另一个\circlearrowright
不同。 我画了一个圆形箭头,这样你可以根据自己的意愿自定义它(箭头尖端、位置、尺寸)。-latex
\documentclass{article}
\usepackage{tikz-cd}
\usetikzlibrary{arrows.meta, bending}
\tikzcdset{
arrow style=tikz,
arrows={>={latex}},
}
\begin{document}
% code for centering the circle arrow taken from https://tex.stackexchange.com/a/66219/101651
\[
\begin{tikzcd}[
every matrix/.append style={name=mycd},
execute at end picture={\draw[-{latex[flex']}]([shift=(230:6mm)]mycd.center) arc (230:-45:6mm);}
]
&[-33pt] H^0(G,A)\ar[r,"f_0"] &[13pt] H^0(G,B)\ar[rd,"g_0"]&[-33pt]\\[40pt]
H^1(G,C)\ar[ur,"\delta_1"] &&& H^0(G,C)\ar[ld,"\delta_0"]\\[40pt]
& H^1(G,B)\ar[ul,"g_1"] & H^1(G,A)\ar[l,"f_1"]
\end{tikzcd}
\]
\end{document}
答案3
使用quotes
库并在六边形中间绘制圆形箭头来改变@Mico 的答案(+1):
\documentclass{article}
\usepackage{tikz,amssymb}
\usetikzlibrary{quotes}
\begin{document}
\[
\begin{tikzpicture}[
>=latex,
everyy edge quotes/.style = {auto, font=\fontsize}
]
\def\radius{3.3cm} % choose an appropriate value
\node (n1) at (120:\radius) {$H^0(G,A)$};
\node (n2) at ( 60:\radius) {$H^0(G,B)$};
\node (n3) at ( 0:\radius) {$H^0(G,C)$};
\node (n4) at (300:\radius) {$H^1(G,A)$};
\node (n5) at (240:\radius) {$H^1(G,B)$};
\node (n6) at (180:\radius) {$H^1(G,C)$};
\path[->]
(n1) edge["$f_0$"] (n2)
(n2) edge["$g_0$"] (n3)
(n3) edge["$\delta_0$"] (n4)
(n4) edge["$f_1$"] (n5)
(n5) edge["$g_1$"] (n6)
(n6) edge["$\delta_1$"] (n1);
\draw[->] (240:1.2) arc (240:-60:1.2);
\end{tikzpicture}
\]
\end{document}
答案4
这是一个使用 的选项chains
。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary {chains}
\newcommand{\radius}{3}
\begin{document}
\[\begin{tikzpicture}[>=latex, start chain=herbrand placed {at=(180-60*\tikzchaincount:\radius)}]
\foreach \H in {{H^0(G,A)},{H^0(G,B)},{H^1(G,C)},{H^1(G,A)},{H^1(G,B)},{H^0(G,C)}}
{\node [on chain] {$\H$};}
\foreach \L[count=\n, evaluate=\n as \m using {int(mod(\n,6)+1)}] in {f_0,g_0,\delta_0,f_1,g_1,\delta_1}
{\draw[->] (herbrand-\n) to[edge label=$\L$] (herbrand-\m);}
\draw[->] (270:.5)arc(270:-45:.5);
\end{tikzpicture}\]
\end{document}