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'm trying to create a fine flowchart that is a bit complicated. Therefore I need a block for a predefined process and a connector block as well as a data block.
Can someone help me? In comment is what I'd like to see in my code to keep my code nicely arranged. The rest of the code is a simple example for the Tikz site.

\documentclass{article}

\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
\pagestyle{empty}


% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=blue!20, 
    text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=blue!20, 
    text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm,
    minimum height=2em]

%\tikzstyle{subroutine} = [draw,rectangle split, rectangle split         horizontal,rectangle split parts=3,minimum height=1cm] 
%\tikzstyle{connector} = [draw,circle,...]
%\tikzstyle{data} = [draw, trapezium, ...]

\begin{tikzpicture}[node distance = 2cm, auto]
    % Place nodes
    \node [block] (init) {initialize model};
    \node [cloud, left of=init] (expert) {expert};
    \node [cloud, right of=init] (system) {system};
    \node [block, below of=init] (identify) {identify candidate models};
    \node [block, below of=identify] (evaluate) {evaluate candidate models};
    \node [block, left of=evaluate, node distance=3cm] (update) {update     model};
    \node [decision, below of=evaluate] (decide) {is best candidate     better?};
    \node [block, below of=decide, node distance=3cm] (stop) {stop};
    % Draw edges
    \path [line] (init) -- (identify);
    \path [line] (identify) -- (evaluate);
    \path [line] (evaluate) -- (decide);
    \path [line] (decide) -| node [near start] {yes} (update);
    \path [line] (update) |- (identify);
    \path [line] (decide) -- node {no}(stop);
    \path [line,dashed] (expert) -- (init);
    \path [line,dashed] (system) -- (init);
    \path [line,dashed] (system) |- (evaluate);
\end{tikzpicture}


\end{document}

enter image description here

share|improve this question
2  
Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. –  Andrew Uzzell Oct 22 '12 at 17:52

1 Answer 1

up vote 15 down vote accepted

I am not sure if something like this is what you need; I changed from the old \tikzstyle to \tikzset:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,shapes.multipart}

\begin{document}
\pagestyle{empty}


% Define block styles
\tikzset{
decision/.style = {diamond, draw, fill=blue!20, 
  text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt},
block/.style = {rectangle, draw, fill=blue!20, 
  text width=5em, text centered, rounded corners, minimum height=4em},
line/.style = {draw, -latex'},
cloud/.style = {draw, ellipse,fill=red!20, node distance=3cm,
  minimum height=2em},
subroutine/.style = {draw,rectangle split, rectangle split horizontal,
  rectangle split parts=3,minimum height=1cm,
  rectangle split part fill={red!50, green!50, blue!20, yellow!50}},
connector/.style = {draw,circle,node distance=3cm,fill=yellow!20},
data/.style = {draw, trapezium,node distance=3cm,fill=olive!20}
}

\begin{tikzpicture}[node distance = 2cm, auto]
    % Place nodes
    \node [block] (init) {initialize model};
    \node [data, left of=init] (expert) {expert};
    \node [connector, right of=init] (system) {system};
    \node [block, below of=init] (identify) {identify candidate models};
    \node [block, below of=identify] (evaluate) {evaluate candidate models};
    \node [block, left of=evaluate, node distance=3cm] (update) {update     model};
    \node [decision, below of=evaluate] (decide) {is best candidate     better?};
    \node [block, below of=decide, node distance=3cm] (test) {test};
    \node [subroutine, below of=test, node distance=3cm] (sub) {part1\nodepart{two}part2\nodepart{three}part3};
    % Draw edges
    \path [line] (init) -- (identify);
    \path [line] (identify) -- (evaluate);
    \path [line] (evaluate) -- (decide);
    \path [line] (decide) -| node [near start] {yes} (update);
    \path [line] (update) |- (identify);
    \path [line] (decide) -- node {no}(test);
    \path [line,dashed] (test) -- (sub);
    \path [line,dashed] (expert) -- (init);
    \path [line,dashed] (system) -- (init);
    \path [line,dashed] (system) |- (evaluate);
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
    
! Package pgfkeys Error: I do not know the key '/tikz/rectangle split horizonta l' and I am going to ignore it. Perhaps you misspelled it. This is the error that I get when I run your code, any ideas what the problem in my version/packages may be? –  Jasper Lammens Oct 22 '12 at 18:40
1  
@JasperLammens sound like your version of PGF is outdated. Which version do you use? Process \documentclass{article} \usepackage{tikz} \begin{document} \pgfversion \end{document} to get your version; if it's less than 2.10, you'll need to update the package. –  Gonzalo Medina Oct 22 '12 at 18:42
    
@GonzaloMedina While using your code with the removal of spilt rectangular part i am getting compressed flow chart. Any suggestion? tex.stackexchange.com/questions/113476/… –  Pratap Dheeraj May 9 '13 at 17:12

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.