14.1.2 Coproduct Diagram With Circular Arrows

Define

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

in the preamble, as well as

\tikzcdset{
    coproductArrows/.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-1);
        % 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-1\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-1) -- ++(\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-1);
        % 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-1\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-1) -- ++(\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=\&,coproductArrows={4.5*\the\DL}{\iota_{1}}{\iota_{2}}]
    {}% Don't remove this line, it's important!
    \&
    C
    \arrow[from=d,"\phi","\exists!"', dashed]
    \&
    {}% Don't remove this line, it's important!
    \\
    A
    \&
    A\icoprod B
    \arrow[from=l,"\inj_{1}"',hook]
    \arrow[from=r,"\inj_{2}",hook']
    \&
    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: