I have to make the following block diagram in TikZ. As I am new to it, I can make a simple horizontal block diagram however, I am unable to connect blocks as shown in the picture below. Kindly can someone provide a TikZ code for this. I have a complicated block diagram, I have just added a part of it. Once I understand this, I can draw the complete diagram.

Required Block Diagram using TikZ

That's the code I have so far:




\tikzstyle{line} = [draw, -latex']

\tikzset{label/.style={draw=gray, ultra thin, rounded corners=.25ex, fill=gray!20,text width=4cm, text badly centered,  inner sep=2ex, anchor=east, minimum height=4em}}

\begin{tikzpicture}[node distance=5cm,auto,>=latex']
% Place nodes
\node [label] (init) {One};
\node [label, right of=init] (node) {One A1};
\node [label, right of=node] (node1) {One A2};
\node [label, right of=node1] (node2) {One B1};
\node [label, right of=node2] (node3) {One B2};
\node [label, right of=node3] (node4) {Two};

% Draw edges
\path [line] (init) -- (node);
\path [line] (node) -- (node1);
\path [line] (node1) -- (node2);
\path [line] (node2) -- (node3);
\path [line] (node3) -- (node4);

\caption{Figure caption}
\end {figure}


The output for the code is

Code Output

  • 1
    Welcome to TeX.SE. It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem and shows how far you have gotten. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem, and provide you help with the specific problem you are having. Oct 27, 2014 at 20:12
  • If you search on TeX.SX you will many examples of these. See for example a-block-diagram-in-tikz, block-diagrams-using-tikz,...
    – user30471
    Oct 27, 2014 at 20:26
  • I have added the code I have so far.
    – Anas
    Oct 27, 2014 at 20:30
  • Andrew, thanks for providing the links. I have understood the solution partially but still not sure how to connect the last node as mentioned in my question.
    – Anas
    Oct 27, 2014 at 20:32

4 Answers 4


I am so basic in latex and this is my first time drawing such diagram, but the functions seem to be easy to understand. I searched and read this answer. I used its code as template to my answer.

enter image description here

        \tikzset{block/.style= {draw, rectangle, align=center,minimum width=2cm,minimum height=1cm},
        \node [block]  (start) {One};

        \node [coordinate, right = 0.5cm of start] (ADL){};
        \node [coordinate, above = 1cm of ADL] (AUL){};
        \node [coordinate, right = 0.5cm of start] (BUL){};
        \node [coordinate, below = 1cm of BUL] (BDL){};

        \node [block, right = 0.5cm of AUL] (A1){One A1};
        \node [block, right = 0.5cm of BDL] (B1){One B1};

        \node [block, right = 1cm of A1] (A2){One A2};
        \node [block, right = 1cm of B1] (B2){One B2};

        \node [coordinate, right = 0.5cm of A2] (AUR){};
        \node [coordinate, below = 0.75cm of AUR] (ADR){};
        \node [coordinate, right = 0.5cm of B2] (BDR){};
        \node [coordinate, above = 0.75cm of BDR] (BUR){};
        \node [coordinate, right = 0.5cm of BUR] (BEnd){};
        \node [coordinate, right = 0.5cm of ADR] (AEnd){};

        \node [block, above right = 0cm and 1cm of B2] (end){Two};

        \path[draw, ->]
            (start) -- (ADL)
            (ADL) -- (AUL)
            (AUL) edge (A1)
            (A1) edge (A2)
            (A2) -- (AUR)
            (AUR) -- (ADR)
            (ADR) edge (AEnd)

            (start) -- (BUL)
            (BUL) -- (BDL)
            (BDL) edge (B1)
            (B1) edge (B2)
            (B2) -- (BDR)
            (BDR) -- (BUR)
            (BUR) -- (BEnd)
  • 1
    many thanks for your efforts and providing the solution.
    – Anas
    Oct 27, 2014 at 21:06
  • @Anas You are welcome. I am so basic in latex. But the code above is so easy to understand. First you define the styles you need, then you introduce the nodes and in the end, you connect them.
    – enthu
    Oct 27, 2014 at 21:07
  • 1
    Many thanks for explaining the code. Although you are a beginner in Latex, I am sure you will be an expert soon.
    – Anas
    Oct 27, 2014 at 21:11

ok, one solution with use of tikz is already anounced ... but anyway:

            > = latex',
node distance = 0mm and 3mm,
mynode/.style = {name=n#1,
                 draw, minimum height=7mm, minimum width=22mm,
                 inner sep=1mm, outer sep = 0mm}
\node[mynode=1]                                    {One};
    \node[mynode=2,above right=0mm and 6mm of n1]  {one A1};
    \node[mynode=3,right= of n2]                   {one A2};
\node[mynode=4,below right=0mm and 6mm of n3]      {Two};
    \node[mynode=5,below right=0mm and 6mm of n1]  {one B1};
    \node[mynode=6,right= of n5]                   {one B2};
\coordinate[right=3mm of n1]    (a);
\coordinate[above left=2mm and 3mm of n4.west]    (b1);
\coordinate[below left=2mm and 3mm of n4.west]    (b2);
\draw       (n1) -- (a);
\draw[->]   (a) |- (n2);
\draw[->]   (a) |- (n5);
    \draw[->]   (n2) -- (n3);
    \draw[->]   (n3) -| (b1) -- (b1 -| n4.west);
    \draw[->]   (n5) -- (n6);
    \draw[->]   (n6) -| (b2) -- (b2 -| n4.west);

in above code I omit all unnecessary package. the result is equivalent as you show in question.

  • Many thanks @Zakro for providing the solution.
    – Anas
    Oct 27, 2014 at 21:04

A PSTricks solution with help from the powerful xfp package:


\usepackage[margin = 4cm]{geometry} % avoids `overfull \hbox' (adjust the margins according to the values of `\sizeW` and `\spreadW`)



% horizontal adjustment
% vertical adjustment
% drawing
\psset{dimen = m, arrows = ->}
  \rput(\adjustW{1.5}{2},\adjustH{0.5}{1}){One A$1$}
  \rput(\adjustW{1.5}{2},\adjustH{0.5}{0}){One B$1$}
  \rput(\adjustW{2.5}{3},\adjustH{0.5}{1}){One A$2$}
  \rput(\adjustW{2.5}{3},\adjustH{0.5}{0}){One B$2$}



All you have to do is choose the horizontal and vertical distances and the drawing will be adjusted accordingly.

  • 1
    Thanks Svend for providing a possible solution. Although it solves the problem, but its quite complicated for me as I haven't used PSTricks before. Since I don't understand it, its hard for me to extend the block diagram to illustrate the full block diagram I require. I will wait if some one else provides a Tikz solution; in the mean time I will try and understand this. Many thanks again for being kind to write the code.
    – Anas
    Oct 27, 2014 at 20:47

Here another shot. Using the positioning-library for setting up the nodes and a \foreach-loop for creating the connections. The position of the arrows can be set with the connecting-angle of the nodes.

\documentclass[tikz, border=5mm]{standalone}
\usetikzlibrary{calc, positioning}
 every node/.style={
  minimum width=2cm,
  minimum height=1cm

 \begin{tikzpicture}[node distance=.25cm and 1cm]
  % Nodes
  \node (one) {One};
  \node (a1) [above right=of one] {One A1};
  \node (a2) [right=of a1] {One A2};
  \node (b1) [below right=of one] {One B1};
  \node (b2) [right=of b1] {One B2};
  \node (two) [below right=of a2] {Two};

  % Connectors
   \foreach \x\r in {a/165,b/195} {
    \draw (one) -| ($(one)!.5!(\x1)$) |- (\x1);
    \draw (\x1) -- (\x2);
    \draw (\x2) -| ($(\x2)!.5!(two)$) |- (two.\r);
  • @moonspit: This is the required solution with minimum amount of coding. Many thanks for sharing this.
    – Anas
    Oct 27, 2014 at 21:09
  • @Anas: Just thought it could be useful to post it as you said this is just a part of your diagram. Perhaps you can use some methods described for completing your diagram with saving you some work.
    – moospit
    Oct 27, 2014 at 21:10
  • @moonspit: Yes, this will be extremely useful as the for loop will simplify the code where numerous node connections are required. Thanks for your effort.
    – Anas
    Oct 27, 2014 at 21:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .