11

How do I draw a circular arrow (to indicate commutativity) in tikz-cd, similar to the one in the middle of the following diagram?

(Image from this question.)

Snowball
  • 2,835
  • 5
  • 17
  • 11
  • Related:https://tex.stackexchange.com/questions/495457/arrows-inside-a-commutative-diagram-using-tikzcd – Watson Mar 24 '21 at 16:57

5 Answers5

10

Use of PDFlatex or XeLaTeX with $\circlearrowleft$ from amssymbol/amsmath with scalable size.

enter image description here

Code

\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}
Jesse
  • 29,686
  • > Minimal working example <. I had to spend a few minutes figuring out the exact syntax for naming arrows and also separating the actual solution from the OP-provided code. Feel free to integrate my MWE into your answer, so that the actual solution is more prominent. – ComFreek Apr 12 '19 at 12:34
7

You can draw an arc using the option -> following the syntax described in the documentation in the Arc Path Reconstruction.

\draw (starting point x, starting point y) arc (starting angle:ending angle:radius);`

For instance this code will produce an arrow like the one requested

\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}

enter image description here

Thanos
  • 12,446
3

MWE from Jesse's answer:

Square diagram with nodes A, B, C, D and circular arrow in the center.

\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}
ComFreek
  • 1,248
  • 2
  • 15
  • 22
2

If you are willing to use Lua- or XeLaTeX:

% arara: lualatex

\documentclass{article}
\usepackage{tikz-cd}
\usepackage{unicode-math}

\begin{document}
\begin{tikzcd}[row sep=5pt, column sep=5pt]
\overbar{A} \arrow[swap, "\overbar{F}_q"]{dd} &  &  \overbar{A}_E    
\arrow["\overbar{F}_{q,E}"]{dd} \arrow[swap, "\pi^\ast"]{ll}  \\
 & \cwopencirclearrow & \\
\overbar{A} & &  \overbar{A}_E \arrow["\pi^\ast"]{ll}
\end{tikzcd}
\end{document}

enter image description here

LaRiFaRi
  • 43,807
2

a variation of accepted answer (+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}

differences: common style for arrows, used shorter (alternative) syntax for \arrows, different way for defining arrows names, defined TikZ picture for inner circled arrow.

enter image description here

Zarko
  • 296,517