如何在 tikz-cd 中绘制一个圆形箭头(表示交换性),类似于下图中间的箭头?
(图片来自这个问题。
答案1
使用 PDFlatex 或 XeLaTeX 和 $\circlearrowleft$ 来amssymbol/amsmath
缩放大小。
代码
\documentclass[border=2pt]{standalone}
\usepackage{amssymb,amsmath}
\usepackage{tikz-cd}
\usetikzlibrary{arrows}
\usepackage{tikz}
\begin{document}
%\tikzset{commutative diagrams/.cd, arrow style=tikz,diagrams={>= latex}}
\begin{tikzcd}[row sep=2cm,column sep=2cm,inner sep=1ex]
\bar A \arrow[thick,swap] {d}{\bar F_q}
&
\bar A_E \arrow[thick,swap]{l}[name=U]{\pi^\star}
\arrow[thick]{d}{\bar F_{q,E}}
\\
\bar A & \bar A_E \arrow[thick]{l}[name=D]{\pi^\star}
\arrow[to path={(U) node[midway,scale=3] {$\circlearrowleft$} (D)}]{}
\end{tikzcd}
\end{document}
答案2
您可以使用选项绘制圆弧->
,语法如下所述文档在里面圆弧路径重建。
\draw(起点 x,起点 y)圆弧(起始角度:终止角度:半径);`
例如,此代码将生成类似请求的箭头
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[step=1cm,gray!50,very thin] (-1.9,-1.9) grid (5.9,5.9);
\draw[very thick,->] (0,0) -- (4.5,0) node[anchor=north west] {\bf{x axis}};
\draw[very thick,->] (0,0) -- (0,4.5) node[anchor=south east] {\bf{y axis}};
\foreach \x in {0,1,2,3,4}
\draw (\x cm,1pt) -- (\x cm,-1pt) node[anchor=north] {$\mathbf{\x}$};
\foreach \y in {0,1,2,3,4}
\draw (1pt,\y cm) -- (-1pt,\y cm) node[anchor=east] {$\mathbf{\y}$};
\draw[thick, ->] (3,2) arc (0:270:1cm);% syntax (starting point coordinates) arc (starting angle:ending angle:radius)
\end{tikzpicture}
\end{document}
答案3
来自杰西的回答:
\documentclass{standalone}
\usepackage{amssymb,amsmath}
\usepackage{tikz-cd}
\usetikzlibrary{arrows}
\usepackage{tikz}
\begin{document}
\begin{tikzcd}
% The syntax for naming arrows is as follows
% \arrow[...options...]{...direction(s)...}[name=...name...]{...label...}
% If you want no label:
% \arrow[...options...]{...direction(s)...}[name=...name...]{}
A \arrow[]{d}{a-c} \arrow[]{r}[name=a-b]{a-b} & B \arrow[]{d}{b-d}\\
C \arrow[]{r}[name=c-d]{c-d} & D
\arrow[to path={(c-d) node[midway,scale=1] {$\circlearrowleft$} (a-b)}]{}
\end{tikzcd}
\end{document}
答案4
已接受答案的变体(+1):
\documentclass[margin=3mm]{standalone}
\usepackage{tikz-cd}
\usetikzlibrary{arrows.meta, bending}
\tikzset{C/.style={circle, minimum size=8mm,
node contents={},
append after command={\pgfextra{%
\draw[-{Straight Barb[flex']}](\tikzlastnode.150) arc (150:450:4mm);}
}}
}
\begin{document}
\begin{tikzcd}[sep=12mm,
arrow style=tikz,
arrows=semithick,
diagrams={>={Straight Barb}}
]
\bar{A}_E \dar["\bar{F}_q" ']
& \bar{A}_E \dar["\bar{F}_{q,E}"]
\lar["\pi^\star" ',""name=U] \\
\bar{A} & \bar{A}_E \lar["\pi^\star" ,""name=D]
\ar[to path={(U) node[pos=.5,C] (D)}]{}
\end{tikzcd}
\end{document}
差异:箭头的通用样式,使用更短(替代)语法\arrows
,定义箭头名称的不同方式,为内圆箭头定义 TikZ 图片。