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 two states positioned horizontally and need to connect them i.e. A -> B and A <- B, how can I position the edges in a way that they don't overlap and my diagram doesn't become a A <-> B but instead it is visible that one can navigate from one another and be able to place the input message above and below.

 (APPEND_COL) edge[???] node[anchor=east,above,xshift=+3.0em]{delete column} (DELETE_COL)
 (DELETE_COL) edge[???] node[anchor=east,above,xshift=+3.0em]{append column} (APPEND_COL)

I have tried setting ??? to above, below, bend left=20, bend right=20 but none of these produces the intended behavior ...

UPDATE: ok here the full code, and another thing, how can I make the loops left and right not so huge?

\begin{tikzpicture}[->,>=stealth']

 % State: FULL_QR
 \node[initial above,state,anchor=north] (FULL_QR)
 {\begin{tabular}{l}
  Recompute QR \\
 \end{tabular}};

 % State: Append column update
 \node[state,           % layout (defined above)
  below left of=FULL_QR,% Position is to the right of FULL_QR
  node distance=5.0cm,  % distance to FULL_QR
  anchor=south] (APPEND_COL) % posistion relative to the center of the 'box'
 {%
 \begin{tabular}{l}     % content
  Append column \\
  \ \ QR update
 \end{tabular}
 };

 % State: Delete column update
 \node[state,            % layout (defined above)
  below right of=FULL_QR,% Position is to the right of FULL_QR
  node distance=5.0cm,   % distance to FULL_QR
  anchor=south] (DELETE_COL) % posistion relative to the center of the 'box'
 {%
 \begin{tabular}{l}      % content
  Delete column \\
  \ \ QR update
 \end{tabular}
 };

 % State: Append column update
 \node[state,                % layout (defined above)
  below right of=APPEND_COL, % Position is to the bottom of APPEND_COL
  node distance=5.0cm,       % distance to APPEND_COL
  anchor=south] (APPEND_ROW) % posistion relative to the center of the 'box'
 {%
 \begin{tabular}{l}          % content
  Append row \\
  \ \ QR update
 \end{tabular}
 };

 % draw the paths and and print some Text below/above the graph
 \path (FULL_QR) edge[bend right=20] node[anchor=west,above,xshift=-3.0em]{append column} (APPEND_COL)
       (FULL_QR) edge[bend left=20] node[anchor=east,above,xshift=+3.0em]{delete
 column} (DELETE_COL)
       (APPEND_COL) edge[bend right=20]
 node[anchor=west,below,xshift=-3.0em]{append row} (APPEND_ROW)
       (DELETE_COL) edge[bend left=20]
 node[anchor=east,below,xshift=+3.0em]{append row} (APPEND_ROW)
       (APPEND_COL) edge[above]
       node[anchor=west,above,xshift=+0.0em]{delete column} (DELETE_COL)
       (DELETE_COL) edge[below]
       node[anchor=east,below,xshift=+0.0em]{append column} (APPEND_COL)
       (APPEND_COL) edge[loop left] node[anchor=west,above,yshift=+1.5em,xshift=+2.0em]{append column}
       (APPEND_COL) (DELETE_COL) edge[loop right] node[anchor=east,above,yshift=+1.5em,xshift=-2.0em]{delete column}
       (DELETE_COL);

\end{tikzpicture}

enter image description here

share|improve this question
    
Putting bend left in both ??? positions should work (and it does in the example you used in your last question). Could you provide a minimal example where it doesn't work? –  Jake Aug 29 '12 at 16:35
    
of course not, bend left and bend right :) –  Giovanni Azua Aug 29 '12 at 16:36
    
Thanks for posting the example. It's usually preferred to make it a complete document though, so people don't have to guess what libraries and setting you're using (in this case, it seems like you changed the state style). –  Jake Aug 29 '12 at 16:53
    
For making the loops smaller, you can set the looseness to something smaller than the default value of 8 (again, this is in the manual). –  Jake Aug 29 '12 at 16:55
1  
Ah, sorry, you have to provide the looseness after the loop left key, because loop left would otherwise reset it to the default value. –  Jake Aug 29 '12 at 17:06
show 2 more comments

1 Answer

up vote 2 down vote accepted

Since the connecting lines have opposing directions, you'll have to use bend left=<value> for both lines, not bend left for one and bend right for the other:

    \documentclass{article}

    \usepackage{pgf}
    \usepackage{tikz}
    \usetikzlibrary{arrows,automata}
    \usepackage[latin1]{inputenc}
    \begin{document}
\begin{tikzpicture}[->,>=stealth']

 % State: FULL_QR
 \node[initial above,state,anchor=north] (FULL_QR)
 {\begin{tabular}{l}
  Recompute QR \\
 \end{tabular}};

 % State: Append column update
 \node[state,           % layout (defined above)
  below left of=FULL_QR,% Position is to the right of FULL_QR
  node distance=5.0cm,  % distance to FULL_QR
  anchor=south] (APPEND_COL) % posistion relative to the center of the 'box'
 {%
 \begin{tabular}{l}     % content
  Append column \\
  \ \ QR update
 \end{tabular}
 };

 % State: Delete column update
 \node[state,            % layout (defined above)
  below right of=FULL_QR,% Position is to the right of FULL_QR
  node distance=5.0cm,   % distance to FULL_QR
  anchor=south] (DELETE_COL) % posistion relative to the center of the 'box'
 {%
 \begin{tabular}{l}      % content
  Delete column \\
  \ \ QR update
 \end{tabular}
 };

 % State: Append column update
 \node[state,                % layout (defined above)
  below right of=APPEND_COL, % Position is to the bottom of APPEND_COL
  node distance=5.0cm,       % distance to APPEND_COL
  anchor=south] (APPEND_ROW) % posistion relative to the center of the 'box'
 {%
 \begin{tabular}{l}          % content
  Append row \\
  \ \ QR update
 \end{tabular}
 };

 % draw the paths and and print some Text below/above the graph
 \path (FULL_QR) edge[bend right=20] node[anchor=west,above,xshift=-3.0em]{append column} (APPEND_COL)
       (FULL_QR) edge[bend left=20] node[anchor=east,above,xshift=+3.0em]{delete
 column} (DELETE_COL)
       (APPEND_COL) edge[bend right=20]
 node[anchor=west,below,xshift=-3.0em]{append row} (APPEND_ROW)
       (DELETE_COL) edge[bend left=20]
 node[anchor=east,below,xshift=+3.0em]{append row} (APPEND_ROW)
       (APPEND_COL) edge[above, bend left=5]
       node[anchor=west,above,xshift=+0.0em]{delete column} (DELETE_COL)
       (DELETE_COL) edge[below, bend left=5]
       node[anchor=east,below,xshift=+0.0em]{append column} (APPEND_COL)
       (APPEND_COL) edge[loop left] node[anchor=west,above,yshift=+1.5em,xshift=+2.0em]{append column}
       (APPEND_COL) (DELETE_COL) edge[loop right] node[anchor=east,above,yshift=+1.5em,xshift=-2.0em]{delete column}
       (DELETE_COL);

\end{tikzpicture}


    \end{document} 
share|improve this answer
add comment

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.