[Tex/LaTex] Tikz task diagram (alignment and arrows)

diagramstikz-pgf

I'm trying to create a diagram like this in LaTeX:

original

This is what I have so far using the assignment structure from texample.net:

enter image description here

Code:

\begin{tikzpicture}[node distance=.8cm,start chain=going below]
\node[punktchain, join] (client) {$Client$};
\node[punktchain, join] (server) {$Job\ server$};
\node[punktchain, join] (worker1) {$Worker_1$};
\node[punktchain, join] (worker2) {$Worker_2$};
\node[punktchain, join] (worker3) {$Worker_3$};
\node[punktchain, join] (worker4) {$Worker_4$};
\end{tikzpicture}

But now I'm stuck. I don't know how to use double-sided arrows and I can't place the workers next to each other.

Best Answer

I don't think a chain is the correct type for your diagram. You can however position the nodes manually. The positioning library provides some advanced positioning keys.

Please also don't misuse mathmode to get italic text. Use \textit for that. You can use math supscript for the index only or use \textsubscript (needs to fixltx2e package).

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}[rounded corners=2pt,inner sep=5pt,node distance=.8cm]
\node [draw](client) {\textit{Client}};
\node [draw,below=of client] (server) {\textit{Job server}};
\node [inner sep=0pt,below=of server] (aux) {\strut};
\node [draw,left=.4cm of aux] (worker2) {\textit{Worker$_2$}};
\node [draw,right=.4cm of aux] (worker3) {\textit{Worker$_3$}};
\node [draw,left=of worker2] (worker1) {\textit{Worker$_1$}};
\node [draw,right=of worker3] (worker4) {\textit{Worker$_4$}};
\draw [<->] (client) -- (server);
\foreach \n in {1,...,4}
   \draw [<->] (server) -- (worker\n.north);
\end{tikzpicture}
\end{document}

Image

Related Question