Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have problem with an small graph. The path between the node J and B should to the right of node I.

Is there a way to do this?

\documentclass[11pt]{article} 
\pagestyle{empty}  
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,automata}

\begin{document}
\centering
\begin{tikzpicture}[>=stealth',shorten >=1pt,node distance=2cm,on grid,initial/.style    ={}]
    \node[state]        (0)                     {};
    \node[state]        (A) [below =of 0]       {};
    \node[state]        (B) [below =of A]       {B};
    \node[state]        (C) [below left =of B]      {};
    \node[state]        (D) [below left =of C]      {};
    \node[state]        (E) [below right =of C]     {};
    \node[state]        (F) [below left =of D]      {};
    \node[state]        (G) [below right =of D]     {};
    \node[state]        (H) [below right =of E]     {};
    \node[state]        (I) [right =of H]       {I};
    \node[state]        (J) [yshift=-2cm,below right =of G]     {J};
    \node[state]        (X) [yshift=-1cm,below =of J]       {};

    \tikzset{mystyle/.style={->}} 
    \path   (0) edge    [mystyle]   node    {}  (A);
    \path   (A) edge    [mystyle]   node    {}  (B);
    \path   (B) edge    [mystyle]   node    {}  (C);
    \path   (C) edge    [mystyle]   node    {}  (D);
    \path   (C) edge    [mystyle]   node    {}  (E);
    \path   (D) edge    [mystyle]   node    {}  (F);
    \path   (D) edge    [mystyle]   node    {}  (G);
    \path   (E) edge    [mystyle]   node    {}  (H);
    \path   (B) edge    [mystyle]   node    {}  (I);
    \path   (F) edge    [mystyle]   node    {}  (J);
    \path   (G) edge    [mystyle]   node    {}  (J);
    \path   (H) edge    [mystyle]   node    {}  (J);
    \path   (I) edge    [mystyle]   node    {}  (J);
    \path   (J) edge    [mystyle]   node    {}  (X);

    \tikzset{mystyle/.style={->,relative=false,in=0,out=0}}
    \draw [->] (J) to [bend right=100 ] (B);
    %\path  (J) edge    [mystyle]   node    {}  (B); %similar problem
\end{tikzpicture}

\end{document}
share|improve this question
1  
Add a min distance option: \draw [->] (J) to [bend right=100,min distance=5cm] (B); –  Sašo Živanović Aug 28 '12 at 22:09
    
great! thank you. –  larkee Aug 28 '12 at 23:04
1  
@SašoŽivanović You should turn your comment into an answer... –  Paul Gaborit Aug 29 '12 at 7:13

2 Answers 2

up vote 4 down vote accepted

just tell him to move to the right by adding an intermediate point

j'ai rajouté la librairie : calc

et modifié le chemin: \draw [->] (J) to [out=0,in=-90] ($(I)+(1,0)$) to [out=90, in=0 ] (B);

\documentclass[11pt]{article} 
\pagestyle{empty}  
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,automata,calc}

\begin{document}
\centering
\begin{tikzpicture}[>=stealth',shorten >=1pt,node distance=2cm,on grid,initial/.style    ={}]
    \node[state]        (0)                     {};
    \node[state]        (A) [below =of 0]       {};
    \node[state]        (B) [below =of A]       {B};
    \node[state]        (C) [below left =of B]      {};
    \node[state]        (D) [below left =of C]      {};
    \node[state]        (E) [below right =of C]     {};
    \node[state]        (F) [below left =of D]      {};
    \node[state]        (G) [below right =of D]     {};
    \node[state]        (H) [below right =of E]     {};
    \node[state]        (I) [right =of H]       {I};
    \node[state]        (J) [yshift=-2cm,below right =of G]     {J};
    \node[state]        (X) [yshift=-1cm,below =of J]       {};

    \tikzset{mystyle/.style={->}} 
    \path   (0) edge    [mystyle]   node    {}  (A);
    \path   (A) edge    [mystyle]   node    {}  (B);
    \path   (B) edge    [mystyle]   node    {}  (C);
    \path   (C) edge    [mystyle]   node    {}  (D);
    \path   (C) edge    [mystyle]   node    {}  (E);
    \path   (D) edge    [mystyle]   node    {}  (F);
    \path   (D) edge    [mystyle]   node    {}  (G);
    \path   (E) edge    [mystyle]   node    {}  (H);
    \path   (B) edge    [mystyle]   node    {}  (I);
    \path   (F) edge    [mystyle]   node    {}  (J);
    \path   (G) edge    [mystyle]   node    {}  (J);
    \path   (H) edge    [mystyle]   node    {}  (J);
    \path   (I) edge    [mystyle]   node    {}  (J);
    \path   (J) edge    [mystyle]   node    {}  (X);

    \tikzset{mystyle/.style={->,relative=false,in=0,out=0}}
    \draw [->] (J) to [out=0,in=-90] ($(I)+(1,0)$) to [out=90, in=0 ] (B);
    %\path  (J) edge    [mystyle]   node    {}  (B); %similar problem
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer

You can play with the looseness=<value> key: the bigger the number, the wider the curve gets. This example illustrates it, just replace the draw by this:

Replacement:

\foreach \x [evaluate=\x as \c using \x*30] in {0.2,0.4,...,3}
{\draw[->,red!\c!blue] (J) to[out=30-20*\x,in=20*\x-30,looseness=\x] (B);}

Effect:

with increasing looseness (from 0.2 to 3) the color fades from blue to red.

enter image description here

share|improve this answer
1  
Great style choice for the colors. –  percusse Aug 29 '12 at 9:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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