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 want to connect two tikz nodes with a line which should not overlap the other nodes. It additionally should branch below the node and run into the top again. I also want to label the edge/line.

I wrote this code:

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
    decorations.pathreplacing,decorations.pathmorphing,shapes,%
    matrix,shapes.symbols}

\begin{document}
\tikzset{
>=stealth',
  punktchain/.style={
    rectangle, 
    rounded corners, 
    draw=black, very thick,
    text width=14em, 
    minimum height=3em, 
    text centered, 
    on chain},
  line/.style={draw, thick, <-},
  every join/.style={->, thick,shorten >=1pt},
}
\begin{tikzpicture}
  [node distance=.6cm,
  start chain=going below,]
     \node[punktchain, join] (intro) {Introduction};
     \node[punktchain, join] (initRun)      {InitialRun};
     \node[punktchain, join] (nthRun)      {nTh Run};
     \node[punktchain, join] (conc) {Conclusion};
  \path[line] (nthRun.north east) -- ++(1,0) |- node{Iteration} (nthRun.south east);
\end{tikzpicture}
\end{document}

This leads into the following result (left), what I want is on the right (red color not intended, just for clarification)

Current status Should status

How can this be done using tikz?

share|improve this question
2  
Does the following work: Replace the line style with redline/.style={draw,ultra thick, red,->,>=latex} and replace the path with \draw[redline] (nthRun.south) |- ++(0,-.3) -| ($(nthRun.east) +(5mm,0)$) node[right]{Iteration}|- ($(nthRun.20) +(0,.3)$) -- (nthRun.20) ; ? –  percusse Jan 2 '12 at 19:13
    
@percusse: Thanks for the solution, it works well for my given example, but if you add more text, so the nTh Run node gets higher, your code does not work. –  theomega Jan 2 '12 at 20:02

1 Answer 1

up vote 9 down vote accepted
\begin{tikzpicture}
  [node distance=.6cm,
  start chain=going below,]
     \node[punktchain, join] (intro) {Introduction};
     \node[punktchain, join] (initRun)      {InitialRun};
     \node[punktchain, join] (nthRun)      {nTh Run};
     \node[punktchain, join] (conc) {Conclusion};
  \path (nthRun) -- (conc) coordinate[pos=.5] (dep) ;
  \path (nthRun.north) -- (nthRun.north east) coordinate[pos=.25] (stop) ;
  \draw [red,thick,->] (dep) -| ([xshift=1cm] nthRun.east) node[right]{Iteration} |- ([yshift=10pt]stop) -- (stop);
\end{tikzpicture}

enter image description here

share|improve this answer
    
@@theomega it's possible to reduce the code but it's more readable like this. –  Alain Matthes Jan 2 '12 at 19:46

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.