1

I want to draw an arrow (A) between two arrows (B and C) in tikz-cd, so that A is directly touching both B and C, like in the following diagram.

correct arrows

The code below seems like the sensible attempt at this diagram, but it's asymmetric: the middle arrow does not touch the lower arrow.

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

\begin{document}

\begin{tikzcd}
    \bullet && \bullet
    \arrow[""{name=0}, from=1-1, to=1-3, bend left]
    \arrow[""{name=1}, from=1-1, to=1-3, bend right]
    \arrow[from=0, to=1]
\end{tikzcd}

\begin{tikzcd}
    \bullet && \bullet
    \arrow[""{name=0}, from=1-1, to=1-3, bend left]
    \arrow[""{name=1}, from=1-1, to=1-3, bend right]
    \arrow[from=1, to=0]
\end{tikzcd}

\end{document}

This is the result:

incorrect arrows

(The example on the bottom has the middle arrow in the opposite direction for comparison. It demonstrates that it is the lower arrow that is the issue, rather than the target arrow.)

Why is this happening, and how can I fix it?

Note that I do not want to simply shorten the middle arrow with a negative length: the solution must work with any pair of arrows, and I don't want to have to guess how much to shorten the middle arrow by. (Also, in some cases I want to shorten the middle arrow symmetrically, which is awkward if one direction has to have extra adjustment applied to it.)

1 Answer 1

2

This is caused by the empty label text above the lower arrow. Replacing ""{name=1} by ""{name=1, below} typesets label text below the arrow, hence solves your problem.

See the last two examples in manual of tikzcd, sec. 2.3 Absolute placement of arrows.

Full example:

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

\begin{document}

\begin{tikzcd}
    \bullet && \bullet
    \arrow[""{name=0}, from=1-1, to=1-3, bend left]
    \arrow[""{name=1, below}, from=1-1, to=1-3, bend right]
    \arrow[from=0, to=1]
\end{tikzcd}

\begin{tikzcd}
    \bullet && \bullet
    \arrow[""{name=0}, from=1-1, to=1-3, bend left]
    \arrow[""{name=1, below}, from=1-1, to=1-3, bend right]
    \arrow[from=1, to=0]
\end{tikzcd}

\end{document}

enter image description here

3
  • Thanks, I had thought the empty label would be treated as having zero width and height.
    – varkor
    Sep 19, 2020 at 23:00
  • @varkor Label is a sub-type of node, and by default every node has a positive inner sep, hence empty node text does not result in a zero-sized node. Sep 19, 2020 at 23:04
  • Ah, thanks, that makes more sense!
    – varkor
    Sep 19, 2020 at 23:20

You must log in to answer this question.

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