3

I am trying to make a flow chart using tikz package. My code is:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,calc,positioning,shapes.geometric}
\tikzstyle{intt}=[draw,text centered,minimum size=5em,text width=9cm,text height=0.34cm]
\tikzstyle{intl}=[draw,text centered,minimum size=2em,text width=2.75cm,text height=0.34cm]
\tikzstyle{int}=[draw,minimum size=2.5em,text centered,text width=2cm]
\tikzstyle{intg}=[draw,minimum size=5em,text centered,text width=9.cm]
\tikzstyle{sum}=[draw,shape=circle,inner sep=2pt,text centered,node distance=3.5cm]
\tikzstyle{summ}=[drawshape=circle,inner sep=4pt,text centered,node distance=3.cm]

\begin{document}

\begin{figure}[!htb]
\centering
\begin{tikzpicture}
  \node [intt] (kp)  {AAAA};
  \node [int]  (ki1) [node distance=2.5cm and 0cm,below left of=kp] {BBBB};
  \node [int]  (ki2) [node distance=3cm and   0cm,below of=kp] {CCCC};
  \node [int]  (ki3) [node distance=2.5cm and 0cm,below right of=kp] {DDDD};
  \node [intg] (ki4) [node distance=5cm,below of=kp] {EEEE};



  \draw[->] (ki1) -- (kp);
  \draw[->] (ki2) -- (kp);
  \draw[->] (ki3) -- (kp);
  \draw[->] ($(ki4.east)+(0,1)$) -- ($(kp.east)+(0,-1)$) node[above,pos=0.4,xshift=1cm] {FFFF};

\end{tikzpicture}
\caption{Caption}
\label{fig:datafusionindirectdirectfc}
\end{figure}


\end{document}

It gives me enter image description here

However, I need a chart looks like as following

enter image description here

2

Not the best way, but one way is by specifying the coordinates of the nodes --

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,calc,positioning,shapes.geometric}
\tikzstyle{intt}=[draw,text centered,minimum size=5em,text width=9cm,text height=0.34cm]
\tikzstyle{intl}=[draw,text centered,minimum size=2em,text width=2.75cm,text height=0.34cm]
\tikzstyle{int}=[draw,minimum size=2.5em,text centered,text width=2cm]
\tikzstyle{intg}=[draw,minimum size=5em,text centered,text width=9.cm]
\tikzstyle{sum}=[draw,shape=circle,inner sep=2pt,text centered,node distance=3.5cm]
\tikzstyle{summ}=[drawshape=circle,inner sep=4pt,text centered,node distance=3.cm]

\begin{document}

    \begin{figure}[!htb]
        \centering
        \begin{tikzpicture}
        \node [intt] (kp)  {AAAA};
        \node [int]  (ki1) [node distance=2.5cm and 0cm] at (-3.5, -3) {BBBB};
        \node [int]  (ki2) [node distance=3cm and   0cm] at (-0.8,-3)  {CCCC};
        \node [int]  (ki3) [node distance=2.5cm and 0cm] at (1.9,-3) {DDDD};
        \node [intg] (ki4) [node distance=5cm,below of=kp] {EEEE};



        \draw[->] (ki1) -- (-3.5,-1);
        \draw[->] (ki2) -- (-0.8,-1);
        \draw[->] (ki3) -- (1.9, -1);
        \draw[->] ($(ki4.east)+(-1,1)$) -- ($(kp.east)+(-1,-1)$) node[above,pos=0.4,xshift=0.6cm] {FFFF};

        \end{tikzpicture}
        \caption{Caption}
        \label{fig:datafusionindirectdirectfc}
    \end{figure}


\end{document}

Here is the output --

enter image description here

  • 1
    \tikzstyle{ ...} is depreciated, instead use `\tikzset{ ...} – Zarko Jun 22 '16 at 17:06
  • thanks for the tip, however, here I have used the same pieces of code. – novice Jun 22 '16 at 17:12
  • You mean 'same as the OP'? So? If the OP used \bf bold, would you leave it? Hopefully not .... – cfr Jun 22 '16 at 22:23
2

An alternative to @Amit nice answer. Main differences are:

  • instead tikzstyle, \tikzset is used
  • all coordinates are relative to the first node

Complete code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, calc, positioning}

\tikzset{
  box/.style = {draw, text centered, outer sep=1mm},
 intt/.style = {box, text width=9cm, minimum height=5.0em},
  int/.style = {box, text width=2cm, minimum height=2.5em},
        }

\begin{document}
    \begin{figure}[htb]
        \centering
    \begin{tikzpicture}[
    node distance = 5mm and 2mm
                        ]
\node (kp)  [intt]  {AAAA};
\node (ki1) [int, below right=
            5mm and 0mm of kp.south west]   {BBBB};
\node (ki2) [int, right=of ki1]             {CCCC};
\node (ki3) [int, right=of ki2]             {DDDD};
\node (ki4) [intt,below right=
            5mm and 0mm of ki1.south west]  {EEEE};
%
\draw[->]   (ki1) edge (ki1 |- kp.south)
            (ki2) edge (ki2 |- kp.south)
            (ki3) edge (ki3 |- kp.south);
\draw[->,transform canvas={xshift=5mm}]   
    (ki4.north -| ki3.east) -- node[right] {FFFF}
    ( kp.south -| ki3.east);
    \end{tikzpicture}
\caption{Caption}
\label{fig:datafusionindirectdirectfc}
    \end{figure}
\end{document}

As you can see, in \tikzset I omit all not used styles and define common style for nodes, which is used in all other nodes with rectangle shape. Result is almost the same:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.