I did several research and many tests and I didn't figure out how to draw the line from (U) and goes to the bottom of S and Q.
This is the code of what I did right now and I want your help to add the line wanted…
\documentclass{report}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\definecolor{arm}{RGB}{100,140,171}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{positioning}
\begin{document}
\pagestyle{empty}
\begin{figure} [htbp]
\hspace{-1.9cm}
\resizebox{!}{10cm}{\begin{tikzpicture}[node distance = 1.5cm, auto,>=stealth]
\tikzstyle{los} = [diamond, draw,fill=arm,text width=3em, text badly centered, text=white, node distance=3cm, inner sep=0pt]
\tikzstyle{quadri} = [rectangle, draw, fill=arm, text width=6em, text centered,text=white , rounded corners, minimum height=2.5em]
\tikzstyle{line} = [draw, thick, color=black, -latex']
\node[quadri] (A) {A};
\node[quadri, below of=A, node distance=1.6cm] (B) {B};
\node[quadri, below left=1cm and 2cm of B ] (C) {C};
\node[los, below of=C , node distance=2.2cm] (D) {D};
\node[quadri,below left=1cm and 1.6cm of D] (E) {E};
\node[quadri,below of=E, node distance=1.6cm](F) {F};
\node[quadri,below of=D, node distance=1.97cm](G) {G };
\node[quadri,below of=G, node distance=1.6cm](H) {H};
\node[quadri,below right=1cm and 1.6cm of D] (I) {I};
\node[quadri,below of=I, node distance=1.6cm](J) {J};
\node[quadri, below right=1cm and 2cm of B ] (K) {K};
\node[quadri,below left=1.3cm and 0.22cm of K] (L) {L};
\node[quadri,below of=L,node distance=1.6cm] (M) {M};
\node[los,below right of=K,node distance=3cm] (O) {O};
\node[quadri,below left=1cm and 0.05cm of O](P){P};
\node[quadri,below of=P, node distance=1.6cm](Q) {Q};
\node[quadri,below right=1cm and 0.05cm of O](R){R};
\node[quadri,below of=R, node distance=1.6cm](S) {S};
\node[quadri,right of=A ,node distance=3.5cm](T) {T};
\node[quadri, text width=7em,right of=T ,node distance=3.4cm](U){U};
\path [line] (A) -- (T);
\path [line] (T) -- (U);
\path [line] (A) -- (B);
\path [line] (B) -- (C);
\path [line] (B) -- (K);
\path [line] (C) -- (D);
\draw[line] (D) -| node [near start,above] {$=0$} (E);
\path [line] (E) -- (F);
\draw[line] (D) -- node[right] {$=1$} (G);
\path [line] (G) -- (H);
\draw[line] (D) -| node [near start,above] {$=0$} (I);
\path [line] (I) -- (J);
\path [line] (K) -- (L);
\path [line] (K) -- (O);
\path [line] (L) -- (M);
\draw[line] (O) -| node [near start,above] {$=1$} (P);
\draw[line] (O) -| node [near start,above] {$>1$} (R);
\path [line] (P) -- (Q);
\path [line] (R) -- (S);
\end{tikzpicture}
}
\caption{Flowchart}
\label{fig:flowchart}
\end{figure}
\end{document}
Best Answer
First of all, I would like to recommend you to not use
\tikzstyle
to define your styles in favor of\tikzset
(for further information see Should \tikzset or \tikzstyle be used to define TikZ styles?).Another remark: I noticed you used both
\draw
and\path
; actually,\draw
is a shortcut for\path[draw]
thus, as your styleline
already contains the keydraw
, there's not difference in using one or the other one. Notice: only in case both exploit theline
style.Also, the connections can be drawn much more easily thanks to a loop: indeed, most of the lines of code are identical.
Said that, the straight way to solve the problem is to use the library
calc
, which helps in defining a commodity coordinate useful to draw the paths.The result:
If your aim is to connect all the leaves of the tree, you might exploit a different solution:
The snippet should replace:
in the previous document.
The new code defines the commodity coordinate (
below scheme
) to be 1cm south ofF
. Now, by exploiting the ability of thecalc
library to compute intersections, each arrow is defined as a path starting frommodule |- below scheme
towardsmodule
. Please refer to the pgfmanual for further information on thecalc
library.This provides you: