2

In the following diagram, I would like to get the label G^F on the dashed arrow to be centered:

enter image description here

However, modifying pos doesn't seem to work as there seems to be a "jump" between pos=0.41 and pos=0.42.

enter image description here (pos=0.41) enter image description here (pos=0.42)

Is there some way to make the label centered? (Actually, I am curious why it is not centered by default or with pos=0.5)

Below is a MWE.

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

\begin{tikzcd}
    & A \\
    C & \widehat{C}
    \arrow["{F}", from=2-1, to=1-2]
    \arrow["{Y}"', from=2-1, to=2-2]
    \arrow["{N^F}"', "{\vdash}"{inner sep=.3ex}, from=1-2, to=2-2]
    \arrow["{G^F}"'{pos=.41}, dashed, bend right, from=2-2, to=1-2]
\end{tikzcd}

\end{document}
1
  • 2
    The arrow isn't symmetrical (meaning the miday or pos=.5 point doesn't lie exactly at that bend where the tangent is vertical). I would just overwrite the automatic placement and add right (i.e. anchor=west) to the G^F node. If you add cells={nodes=rectangle} as an option to the tikzcd environment (ignoring the mess that this creates) you will see that the pos=.5 node is correctly placed again. Mar 15, 2023 at 2:15

2 Answers 2

3

This is an issue with curved arrows when they are very short. Two suggestions:

  1. Increase sep so the nodes are farther apart.
  2. Reduce the bend angle. I used bend right=15 in the diagram. (Then you'll probably want to shift the arrow right also.)

enter image description here

Here is the code:

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

\begin{tikzcd}[sep=large]
    & A \\
    C & \widehat{C}
    \arrow["F", from=2-1, to=1-2]
    \arrow["Y"', from=2-1, to=2-2]
    \arrow["N^F"', "{\vdash}"{inner sep=.3ex}, from=1-2, to=2-2]
    \arrow["G^F"', dashed, bend right=15, shift right=1.5, from=2-2, to=1-2]
\end{tikzcd}

\end{document}
0

Just only for comparison with xy package:

\documentclass[a4paper,12pt]{article}
\usepackage[cmtip,all]{xy}
\begin{document}
\xymatrix@R=2pc@C=3pc{ & A \ar[d]^{\vdash}\\
C \ar[ur]^F_(.70){N^F} \ar[r]_Y & \widehat{C} \ar@/_1.2pc/@{-->}[u]_{G^F}
}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .