3

I have many nodes and want to connect two of them, but in such way that the path is not scratch off nodes, which are between these two like in the enter image description here example below (I want to connect L_0 and R_0):

To create this path I used following command:

\path [line,dashed] (l0) edge [] node {} (r0);
  • You want to bend the line so that it won't touch other nodes? – user11232 Nov 2 '14 at 1:03
4

Like this?

\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}
\begin{document}
  \begin{tikzpicture}
    \node (a) {a};
    \node[right=1cm of a] (b) {B};
    \node[right=1cm of b] (c) {C};
    \node[right=1cm of c] (d) {D};
    \node[right=1cm of d] (e) {E};
    \node[right=1cm of e] (f) {F};
    \draw [dashed] (a) to[bend left] node {} (f);
    \draw [red,dashed] (a) -- ++(0,5mm) -| node {} (f);
  \end{tikzpicture}
\end{document}

enter image description here

  • Thanks! I was thinking exactly about something like the red dashed line! :) – Ziva Nov 2 '14 at 7:23
3

I would suggest you use the to syntax and specify the out and in angles. Here are a few examples and perhaps adjust the distance:

enter image description here

Code:

\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}
\begin{document}
  \begin{tikzpicture}[thick, dashed]
  \foreach [count=\i] \x in {$L_0$, $R_3$, $R_1$, $L_2$, $R_0$} {
      \node (\i) at (\i,0) {\x};
  }
  \draw [olive  ] (1.north) to[out=50, in=100] (5.north);
  \draw [red    ] (1.north) to[out=30, in=150] (5.north);
  \draw [blue   ] (1.south) to[out=-30, in=-150] (5.south);
  \draw [magenta] (1.south) to[out=-30, in=-150, distance=2.5cm] (5.south);
  \draw [orange ] (1.south) to[out=-70, in=-110] (5.south);
  \end{tikzpicture}
\end{document}
  • Thank you for your suggestion and examples, which are very helpful! – Ziva Nov 2 '14 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.