TeX - LaTeX Asked by varkor on December 11, 2020
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.
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:
(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.)
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}
Correct answer by muzimuzhi Z on December 11, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP