4

I'm trying to diagram a mathematical concept, but for some reason the symbol is tilted and the labels are not centered. I've tried tweaking parameters such as pos, but there must be a better way in general:

\[
\begin{tikzcd}
\Gph\arrow[r,bend left,"F_C",""{name=A, below}] & \Cat\arrow[l,bend left,"U_G",""{name=B,above}] \arrow[from=A, to=B, symbol=\dashv] \arrow[r,bend left,"F_P",""{name=C, below}] & \Pos \arrow[l,bend left,"U_C",""{name=D,above}] \arrow[r,bend left,"U_S",""{name=E, below}] \arrow[from=C, to=D, symbol=\dashv] & \Set \arrow[l,bend left,"F_P",""{name=F,above}] \arrow[from=F, to=E, symbol=\dashv]
\end{tikzcd}
\]

result

Please let me know a more systematic way to make these diagrams; thank you!

2 Answers2

8

I just reworked your entry as follows.

\documentclass{article}
\usepackage{tikz-cd}
\usetikzlibrary{arrows}

\def\ac{\rotatebox[origin=c]{90}{$\dashv$}} %rotate dash anti-cw
\def\cw{\rotatebox[origin=c]{-90}{$\dashv$}} %rotate dash cw
%\tikzset{adj/.style={pos=0.545,outer sep=3pt}} %adjust label position along path

\begin{document}
\begin{tikzcd}[column sep=small]
    Gph \arrow[bend left,below]{rr}{F_C}
    & \cw &
    \arrow[bend left,above]{ll}{U_G} Cat \arrow[bend left,below]{rr}{F_P}
    %\arrow[bend left,above, adj]{ll}{U_G} Cat \arrow[bend left,below]{rr}{F_P}
    & \dashv &
    \arrow[bend left,above]{ll}{U_C} Pos \arrow[bend left,below]{rr}{U_S}
    & \ac &
    Set \arrow[bend left,above]{ll}{F_P}
\end{tikzcd}
\end{document} 

enter image description here

I have also added code to rotate the \dashv symbol. Showing the normal \dashv and the clockwise and anticlockwise rotations.

Added a command (commented out) for adjusting the position of a label along the arrow, and its distance from the line. You can play around with values until you get a result you like. Below, the first picture shows the resulting misplaced label with 'column sep = tiny'.

enter image description here

The subsequent picture using the commented out commands adjust the label position to be aligned vertically with the other label, and showing that you can push the label further from the line by 3pt.

enter image description here

Dunk the Lunk
  • 600
  • 4
  • 10
2

A different approch to the original code.

enter image description here

\documentclass{article}
\usepackage{tikz-cd}
\newcommand{\pdashv}{\rotatebox[origin=c]{-90}{$\dashv$}}
\newcommand{\vdashv}{\rotatebox[origin=c]{0}{$\dashv$}}
\newcommand{\sdashv}{\rotatebox[origin=c]{90}{$\dashv$}}
\begin{document}
\begin{tikzcd}
Gph \arrow[rr, "F_C", bend left] & \pdashv & Cat 
\arrow[ll, "U_G", bend left] 
\arrow[rr, "F_P", bend left] & \vdashv & Pos \arrow[ll, "U_C", bend left] 
\arrow[rr, "U_S", bend left] & \sdashv & Set \arrow[ll, "F_P", bend left]
\end{tikzcd}
\end{document} 
Sebastiano
  • 54,118