I'm writing about Category theory using tikz-cd
and have a pair of adjoint functors, which is usually denoted by
$F\dashv G$
I would like to have this \dashv
symbol in a commutative diagram like this (so it should replace the double arrow).
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\[\begin{tikzcd}[ampersand replacement=\&] C\ar[r,bend left,"F",""{name=A, below}] \& D\ar[l,bend left,"G",""{name=B,below}] \ar[from=A, to=B, Rightarrow]\end{tikzcd}\]
\end{document}
But I don't know how to do this. Could anyone please help me?
Best Answer
You can define your own arrow style which takes a symbol instead of an actual arrow. The rest stays as you have just done.
In order to explain this a bit, I made another example:
In this code you can just comment out line by line (the single line options in the
\tikzset
) and easily see what happens.draw=none
,sloped
, andallow upside down
shout be clear than.auto=false
is default but I included it in case you use that style inside diagrams whereauto
is set to true. If you remove this line, nothing will happen in this very case here, but if you just remove=false
, you will get a wrong result. Please refer to the manual oftikz-cd
in order to get more reference on all those options.Finally let's have a look on the syntax: I have defined a new TikZ-style for you, which you can use anywhere you want. As we are using this style inside an arrow node, we have to tell it not to draw this very node. Then we say that for any
to
directive (the arrows intikz-cd
do use that), we want to append the style of anedge node
(a node which combines two elements fromfrom
toto
(see the TikZ) manual). Such anedge node
also has anode
which is referred to as a label intikz-cd
. It is set on top of the center of thatedge node
. We define any desired styling for this node (you may insert colors or whatever as well) but leave the actual node text which comes in between the{<some text>}
free or better, replace it by{$#1$}
. For sure you have seen such dummies for other commands already. It just says that the first argument of this macro shall be inserted in place of the#1
which happens to be in math-mode and inside the node text here. The arguments of TikZ styles are used as a key value directive so now you can usesymbol={=}
,symbol={\infty}
or whatever you like.