I wanted it to look like \rightlefttarrows
(as in one arrow in top of the other)
\begin{tikzcd}
X \ar{r} & \ar[l] B
\end{tikzcd}
The above code does not have that effect and instead fuses both arrows.
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityI wanted it to look like \rightlefttarrows
(as in one arrow in top of the other)
\begin{tikzcd}
X \ar{r} & \ar[l] B
\end{tikzcd}
The above code does not have that effect and instead fuses both arrows.
This can be done using the shift left
key (or shift right
in the second example). Both produce the same output:
The direction of the shift is from the perspective of "walking along the arrow". So if the arrow is drawn from B
to X
, the left side is below. But if the arrow is drawn from X
to B
, then left is above, even if the arrow is pointing "backwards". You can adjust the spacing between the arrows to your liking.
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
X \arrow[r, shift left=2pt] & B \arrow[l, shift left=2pt]
\end{tikzcd}
\begin{tikzcd}
X \arrow[r, shift left=2pt] \arrow[r, <-, shift right=2pt]& B
\end{tikzcd}
\end{document}