I am trying to draw several parallel arrows between the same nodes, to get roughly this result:
What I would need is a hypothetical perpendicular shift
key, which would shift the edge along its perpendicular. Using xshift
works for the vertical lines, but not the horizontal ones, and vice versa for yshift
.
I tried using decorate,decoration={lineto,raise=0.1cm}
, but it seems to have no effect on the path. It kinda works with decorate,decoration={brace, amplitude=0,raise=0.1cm}
, but it feels a bit clunky, and the arrow heads are all pointing upwards:
@Torbjørn T. mentionned this very similar question, which gets the line distance and arrowheads right, but alters the line length (the lines start and end near the nodes' centers, instead of starting near their borders):
Here's the code for the brace
version:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,decorations.pathreplacing}
\begin{document}
\tikzset{
rel1/.style={->, red, decorate,decoration={brace, amplitude=0,raise=0.1cm}},
rel2/.style={->, green, },
rel3/.style={->, blue, decorate,decoration={brace, amplitude=0,raise=-0.1cm}}
}
\begin{tikzpicture}
\node (Z) at (0,0) {0};
\node (A) at (0,1) {A};
\node (B) at (1,1) {B};
\node (C) at (1,0) {C};
\draw[rel1] (Z) to (A);
\draw[rel1] (Z) to (B);
\draw[rel1] (Z) to (C);
\draw[rel2] (Z) to (A);
\draw[rel2] (Z) to (B);
\draw[rel2] (Z) to (C);
\draw[rel3] (Z) to (A);
\draw[rel3] (Z) to (B);
\draw[rel3] (Z) to (C);
\end{tikzpicture}
\end{document}
I'm looking for a solution that can be used simply as a style on the whole path, and doesn't require knowing the angle of the line where it is used.