14.1.1 Product Diagram With Circular Arrows

Define

\newlength{\DL}
\setlength{\DL}{0.9em}

in the preamble, as well as

\tikzcdset{
    productArrows/.style args={#1#2#3}{
    execute at end picture={
        % FIRST ARROW
        % Step 1: Draw arrow body
        \begin{scope}
            \clip (\tikzcdmatrixname-1-2.east) -- (\tikzcdmatrixname-2-2.center) -- (\tikzcdmatrixname-2-3.north) -- (\tikzcdmatrixname-1-3.center) -- cycle;
            \path[draw,line width=rule_thickness] (\tikzcdmatrixname-1-2) arc[start angle=90,end angle=0,radius=#1];
        \end{scope}
        % Step 2: Draw arrow head
        % Step 2.1: Find the point at which to place the arrowhead
        \path[name path=curve-1-a] (\tikzcdmatrixname-1-2.east) -- (\tikzcdmatrixname-2-2.center) -- (\tikzcdmatrixname-2-3.north) -- (\tikzcdmatrixname-1-3.center) -- cycle;
        \path[name path=curve-1-b] (\tikzcdmatrixname-1-2) arc[start angle=90,end angle=0,radius=#1];
        \fill [name intersections={of=curve-1-a and curve-1-b}] (intersection-2);
        % Step 2.2: Find the angle at which to place the arrowhead
        \coordinate (arc-start) at (\tikzcdmatrixname-1-2.east);
        \coordinate (arc-center) at (\tikzcdmatrixname-2-2.center);
        \draw let
            \p1 = ($\left(intersection-2\right) - \left(arc-center\right)$), % \p1 is the vector from the arc's centre to the intersection point (we use i-2 for the 2nd intersection)
            \n1 = {atan2(\y1, \x1)}, % \n1 is the angle of that vector in degrees
            \n2 = {\n1 - 90} % \n2 is the angle of the tangent (90 degrees from the radius vector for a circle)
          in [->] (intersection-2) -- ++(\n2:0.1pt);
        % SECOND ARROW
        % Step 1: Draw arrow body
        \begin{scope}
            \clip (\tikzcdmatrixname-1-2.west) -- (\tikzcdmatrixname-2-2.center) -- (\tikzcdmatrixname-2-1.north) -- (\tikzcdmatrixname-1-1.center) -- cycle;
            \path[draw,line width=rule_thickness] (\tikzcdmatrixname-1-2) arc[start angle=90,end angle=180,radius=#1];
        \end{scope}
        % Step 2: Draw arrow head
        % Step 2.1: Find the point at which to place the arrowhead
        \path[name path=curve-2-a] (\tikzcdmatrixname-1-2.west) -- (\tikzcdmatrixname-2-2.center) -- (\tikzcdmatrixname-2-1.north) -- (\tikzcdmatrixname-1-1.center) -- cycle;
        \path[name path=curve-2-b] (\tikzcdmatrixname-1-2) arc[start angle=90,end angle=180,radius=#1];
        \fill [name intersections={of=curve-2-a and curve-2-b}] (intersection-2);
        % Step 2.2: Find the angle at which to place the arrowhead
        \coordinate (arc-start) at (\tikzcdmatrixname-1-2.west);
        \coordinate (arc-center) at (\tikzcdmatrixname-2-2.center);
        \draw let
            \p1 = ($\left(intersection-2\right) - \left(arc-center\right)$), % \p1 is the vector from the arc's centre to the intersection point (we use i-2 for the 2nd intersection)
            \n1 = {atan2(\y1, \x1)}, % \n1 is the angle of that vector in degrees
            \n2 = {\n1 - 90} % \n2 is the angle of the tangent (90 degrees from the radius vector for a circle)
          in [<-] (intersection-2) -- ++(\n2:0.1pt);
          % Labels
          \path (\tikzcdmatrixname-1-2) arc[start angle=90,end angle=180,radius=#1] node[above left,pos=0.5] {$\scriptstyle #2$};
          \path (\tikzcdmatrixname-1-2) arc[start angle=90,end angle=0,radius=#1] node[above right,pos=0.5] {$\scriptstyle #3$};
    }
  }
}

The code

\begin{tikzcd}[row sep={4.5*\the\DL,between origins}, column sep={4.5*\the\DL,between origins}, background color=backgroundColor, ampersand replacement=\&,productArrows={4.5*\the\DL}{p_{1}}{p_{2}}]
    {}% Don't remove this line, it's important!
    \&
    P
    \arrow[d,"\phi"'{pos=0.475},"\exists!"{pos=0.475}, dashed]
    \&
    {}% Don't remove this line, it's important!
    \\
    A
    \&
    A\times B
    \arrow[l,"\pr_{1}"{pos=0.425},two heads]
    \arrow[r,"\pr_{2}"'{pos=0.425},two heads]
    \&
    B
\end{tikzcd}

will then produce the following diagram:


Noticed something off, or have any comments? Feel free to reach out!


You can also use the contact form below: