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 hope you help me. I want to connect these nodes as in the attached image. I tried it using chains, but I could'n get it. I'd like to use the best way to connect nodes.

\documentclass{article}
\title{New}
\usepackage{tikz}
\usetikzlibrary{chains}

\begin{document}
\begin{center}
\begin{tikzpicture}

 \draw (6,3) node (problema) [draw,rounded corners,align=left,text width=50mm]{\small{\center \textbf{TITLE}\\ Text text text text text text text text text text text text text text text text text text text}};

 \draw (0,0) node (causa1) [draw,rounded corners,align=left,text width=40mm]{\small{\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text}};
 \draw (6,0) node (causa2) [draw,rounded corners,align=left,text width=40mm]{\small{ \textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text}};
 \draw (12,0) node (causa3) [draw,rounded corners,align=left,text width=40mm]{\small{ \textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text}};

\draw (problema) -| (causa1);
\draw (problema) -- (causa2);
\draw (problema) -| (causa3);

 \draw (0,-2.2) node (indir1) [draw,rounded corners,align=left,text width=30mm]{\small{\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text}};
 \draw (0,-4.4) node (indir2) [draw,rounded corners,align=left,text width=30mm]{\small{\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text}};
 \draw (0,-6.6) node (indir3) [draw,rounded corners,align=left,text width=30mm]{\small{\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text}};
 \draw (0,-8.8) node (indir4) [draw,rounded corners,align=left,text width=30mm]{\small{\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text}};

 \draw (6,-2.2) node (indir5) [draw,rounded corners,align=left,text width=30mm]{\small{\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text}};
 \draw (6,-4.4) node (indir6) [draw,rounded corners,align=left,text width=30mm]{\small{\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text}};
 \draw (6,-6.6) node (indir7) [draw,rounded corners,align=left,text width=30mm]{\small{\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text}};
 \draw (6,-8.8) node (indir8) [draw,rounded corners,align=left,text width=30mm]{\small{\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text}};
 \draw (6,-11) node (indir9) [draw,rounded corners,align=left,text width=30mm]{\small{\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text}};

 \draw (12,-2.2) node (indir10) [draw,rounded corners,align=left,text width=30mm]{\small{\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text}};

\end{tikzpicture}
\end{center}

\end{document}

enter image description here

share|improve this question
add comment

2 Answers 2

up vote 6 down vote accepted

You can use relative coordinates for this. An example for the top can be:

\draw (problema) -- ++(0, -10pt) -| (causa1);

Similar for the rest. Move the line a bit then use the straight-angled link.

share|improve this answer
    
For the rest I used: \draw (causa1.west)--++(-10mm,0mm)--++(0mm,-2.2)--(indir1.west);; Thanks –  Isai Dec 30 '12 at 15:06
1  
No problem. You should really use the -| or |- for the final two lines though. It makes life very easy. –  recluze Dec 30 '12 at 15:12
    
You're right, for the line of my comment, |- instead of --++(0mm,-2.2)-- –  Isai Dec 30 '12 at 15:47
add comment

You can use chains for this! And even better we can automatically draw the lines with the join option.

But first things first: Please use styles. And please use the positioning library (loaded by the chains library) to place the nodes instead of hard-coding the coordinates. The positioning library makes it more intuitive to place nodes and also makes sure, that the nodes do not overlap.

I used my paths.ortho library and its path operator lr and rl. The library itself comes from my answer to How to draw a return arrow from node-3 to node-1 (but don’t use that code from that answer) and is further explained in another answer of mine.

Without the paths.ortho library, the place nodes on chain and install special path style’s definition would be

place nodes on chain and install special path/.style n args={3}{
  every node/.append style={on chain=#1,join},
  every join/.append style={to path=(#1-begin.#3) #2 (\tikztotarget)}
}

which can then be used as

place nodes on chain and install special path={ch1}{-- ++(left:.5cm) |-}{west}
place nodes on chain and install special path={ch2}{-- ++(left:.5cm) |-}{west}

and

place nodes on chain and install special path={ch}{-- ++(right:.5cm) |-}{east}

while having the same output.

Code

\documentclass[tikz,convert]{standalone}
\usetikzlibrary{chains,paths.ortho}

\begin{document}
\begin{tikzpicture}[
  ultra thick,
  node distance=1cm and 2cm,
  every node/.append style={
    draw,
    rounded corners,
    align=left,
    font=\small
  },
  top node/.style={text width=+55mm},
  wide node/.style={text width=+40mm},
  thin node/.style={text width=+30mm},
  start chain/.list={ch1 going below, ch2 going below, ch3 going below}
]

\node[top node](problema) {\textbf{TITLE}\\ Text text text text text text text text text text text text text text text text text text text};

\begin{scope}[every node/.append style={wide node}]
  \node[below=of problema, on chain=ch2] (causa2) {\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text};
  \node[left=of causa2   , on chain=ch1] (causa1) {\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text};
  \node[right=of causa2  , on chain=ch3] (causa3) {\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text};
\end{scope}
\begin{scope}[
  every node/.append style={thin node},
  place nodes on chain and install special path/.style 2 args={
    every node/.append style={on chain=#1,join},every join/.append style={to path=(#1-begin) #2 (\tikztotarget)}
  }
]
  \begin{scope}[place nodes on chain and install special path={ch1}{lr}]
    \node {\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text};
    \node {\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text};
    \node {\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text};
    \node {\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text};
  \end{scope}
  \begin{scope}[place nodes on chain and install special path={ch2}{lr}]
    \node {\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text};
    \node {\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text};
    \node {\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text};
    \node {\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text};
    \node {\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text};
  \end{scope}
  \begin{scope}[place nodes on chain and install special path={ch3}{rl}]
    \node {\textbf{Title}\\ Text text text text text text text text text text text text text text text text text text text};
  \end{scope}
\end{scope}

\draw (problema) -| (causa1);
\draw (problema) -- (causa2);
\draw (problema) -| (causa3);
\end{tikzpicture}
\end{document}

Output

enter image description here

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.