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 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.

share|improve this question

1 Answer 1

up vote 7 down vote accepted

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

share|improve this answer
    
This is exactly what I needed. I also didn't knew about the \textit. Thanks! –  Jan Apr 13 '11 at 13:47

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.