2

I try to draw something with six nodes and four arrows. The arrows should touch in the most bended point - in the middle of the arrows.

However, I don't want to play around with moving nodes so that the arrows touch by coincidence. What is the best way?

So far I have this:

\documentclass[tikz,border=3mm]{standalone}
 \usetikzlibrary{positioning}
 \begin{document}
 \begin{tikzpicture}
 \node[](A){A};
 \node[below = of A](B){B};
\node[left = of A](C){C};
\node[right = of A](D){D};
\node[left = of B](E){E};
\node[right = of B](F){F};
\draw [->] (B.east) to [bend right] (A.east);
\draw [->] (F.west) to [bend left] (D.west);
\draw [->] (A.west) to [bend right] (B.west);
\draw [->] (C.east) to [bend left] (E.east);

\end{tikzpicture}
\end{document}
1
  • 1
    Please, can you edit your question putting a complete code with all package starting from \documentclass and not a fragment?
    – Sebastiano
    May 10, 2020 at 19:21

1 Answer 1

4

With barycentric coordinates you can determine a good candidate for the touching point, which can be used in various constructions such as

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\begin{scope}
 \node(A){A};
 \node[below = of A](B){B};
 \node[left = of A](C){C};
 \node[right = of A](D){D};
 \node[left = of B](E){E};
 \node[right = of B](F){F};
 \path (barycentric cs:A=1,B=1,D=1,F=1) coordinate (ABDF)
     (barycentric cs:A=1,B=1,C=1,E=1) coordinate (ABCE);
 \draw[->] (B.east) to[out=45,in=-90] (ABDF) to[out=90,in=-45] (A.east);
 \draw[->] (F.west) to[out=135,in=-90] (ABDF) to[out=90,in=-135] (D.west);
 \draw[->] (A.west) to[out=-135,in=90] (ABCE) to[out=-90,in=135] (B.west);
 \draw[->] (C.east) to[out=-45,in=90] (ABCE) to[out=-90,in=45]  (E.east);
\end{scope}
\begin{scope}[xshift=5cm]
 \node(A){A};
 \node[below = of A](B){B};
 \node[left = of A](C){C};
 \node[right = of A](D){D};
 \node[left = of B](E){E};
 \node[right = of B](F){F};
 \path (barycentric cs:A=1,B=1,D=1,F=1) coordinate (ABDF)
     (barycentric cs:A=1,B=1,C=1,E=1) coordinate (ABCE);
 \draw[->] plot[smooth] coordinates {(B.east) (ABDF) (A.east)};
 \draw[->] plot[smooth] coordinates {(F.west) (ABDF) (D.west)};
 \draw[->] plot[smooth] coordinates {(A.west) (ABCE) (B.west)};
 \draw[->] plot[smooth] coordinates {(C.east) (ABCE) (E.east)};
\end{scope}
\end{tikzpicture}
\end{document}

enter image description here

Of course one can make the arrow heads more funky etc.

6
  • Thank you for the fast answer. I played around with your solution and got the problem, that the arrows are not symmetrical anymore if I replace the letters by words with different length. Is this because of the barycentric?
    – Auk
    May 10, 2020 at 20:34
  • 1
    @Auk No, this is because the barycentric cs: uses the center anchors. So one would have to compute the barycenter of the node anchors that get actually used in the paths. The above solution is really for the problem of the question, for more general settings one has to do other things. Therefore you might want to describe the actual use case situation in a bit more detail.
    – user194703
    May 10, 2020 at 20:42
  • Your solution is nice, in principal. I just wanna use this solution multiple times with different content by replacing A, B, C, D, E and F by different words. The symmetry already got lost here - can't add the code here. I just replaced the letters by different words.
    – Auk
    May 11, 2020 at 19:52
  • @Auk As I said, if you ask a question in which you detail the use case, one can write an answer for that. The above answer is for situations that are close to what you have in your MWE. If you have nodes of different sizes, and perhaps at variable positions, one has to define what the desired outcome is, then one can write an answer for that. It is much harder to anticipate for which settings a user wishes to apply a code without being explicitly told.
    – user194703
    May 11, 2020 at 20:22
  • Exactly, the nodes will have different sizes. That's what's changing. I'm not sure if the position of the nodes changes automatically when the node size changes (it doesn't seem to change). So how can I adjust your solution for different node sizes? The desired outcome are symmetrical arrows on the right side and the left side of "A" and "B" (later A and B are replaced by words).
    – Auk
    May 11, 2020 at 20:35

You must log in to answer this question.

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