Adjoint functors with tikz-cd

If you want to avoud adding additional rows or column but instead want to use coordinates/nodes and a path between them to place nodes, you can use the following to styles:

  • from=<c1> to <c2> where <c1> and <c2> are coordinates/nodes (without parentheses).

    This translates to the to path: (<c1>) -- (<c2>)\tikztonodes.
    The \tikztonodes macro is needed so that nodes (like your \vdash) are placed on this path.

  • The no line style accomplishes two things:

    First, the line is not drawn (draw=none), and then for the “labels” (that tikz-cd-ish for “nodes along path”) the auto option is deactivated which, when activated, places the nodes at one of both sides of the path (left/right).

    The description styles does something similar as it forces the anchor to center (which resets the actions of auto) and applies a fill with the background color.

    As you don’t draw the line, there is no need to add a filling.

Similar shenanigans can be found in my answers to

  • Change the orientation of Arrow of xtwocell in the 2cell option for xy (drawing a line to a node/coordinate not in cell)
  • Replacing an arrow with an inclusion symbol in Tikz (using a symbol like \subseteq as an arrow)

Code

\documentclass[tikz]{standalone}
\usepackage{tikz-cd}
\tikzset{
  no line/.style={draw=none,
    commutative diagrams/every label/.append style={/tikz/auto=false}},
  from/.style args={#1 to #2}{to path={(#1)--(#2)\tikztonodes}}}
\begin{document}
\begin{tikzcd}
\mathbf{C} \arrow[bend left=35]{r}[name=F]{F}
   & \mathbf{D}\arrow[bend left=35]{l}[name=U]{U}
               \arrow[from=F to U, no line]{}{\vdash}
\end{tikzcd}
\end{document}

Output

enter image description here


As you're not drawing the vertical arrow in that example, you could instead add an additional column in the matrix to place the \vdash in the middle. You then have to modify the arrows to go two columns to the right/left, by adding an additional r/l in the first argument:

enter image description here

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}

\begin{tikzcd}
    \mathbf{C} \arrow[bend left=35]{rr}{F} % note {rr} instead of {r}
  & \vdash                                 % additional column for \vdash
  & \mathbf{D}\arrow[bend left=35]{ll}{U}  % note {ll} instead of {l}
\end{tikzcd}

\end{document}

A minor point on Qrrbrbirlbel's answer: the \dashv should be rotated. This can be done as follows:

\documentclass{standalone}
\usepackage{tikz-cd}
\usepackage{amsfonts}

\begin{document}
\begin{tikzcd}
\mathbb{C}
\arrow[r, "F"{name=F}, bend left=25] &
\mathbb{B}
\arrow[l, "U"{name=G}, bend left=25]
%--- Adjunction Symbol
\arrow[phantom, from=F, to=G, "\dashv" rotate=-90, no line]
\end{tikzcd}
\end{document}

giving

Tags:

Tikz Cd