TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to reproduce a picture and I'm having a problem (since this is my very first experience with tikzpictures). The picture is the following: image to be reproduced

My problem is of how to create the part that is inside the frame in the middle and more precisely how am I supposed to "frame" it like that (with the underlying part - description) and connect it later with the other nodes I have.

Sorry if the question is very naive. Thanks in advance for any help.

share|improve this question
up vote 7 down vote accepted

Here's a solution using the fit and calc libraries. The \pgflinewidth/2 is used to fix the width of the lower rectangle.



\node[ellipse,label=270:C++,align=left,draw] (a) at (0,0) {Simulation\\ Objects};
\node[ellipse,label=270:OT cl,align=left,draw] (b) at (4,0) {Simulation\\ Objects};
\draw[latex-latex] (a) -- (b);
\node (c) at ($(a.south west)+(-1,-1)$) {};
\node (d) at ($(b.north east)+(1,1)$) {};
\node[fit=(c)(d),draw] (e) {};
\draw ($(e.south west)+(\pgflinewidth/2,0)$) rectangle node {NS2 Shell Executable Command (ns)} ($(e.south east)+(-\pgflinewidth/2,-0.7)$);


enter image description here

share|improve this answer
For some reason the text in the lower rectangle is out of place for me as shown in the following picture Also when I'm trying to add the node from the left (using \node (tclscript) [left of=e] {\includegraphics[width=2cm]{images/FileScript}} node at +(0,1.00) {\footnotesize\sc Tcl Simulation Script};) I get the following result – gkaran89 Aug 9 '12 at 21:18
Try left=of e.west for the second issue. Which version of TikZ are you using? – Tom Bombadil Aug 9 '12 at 21:56
Package: tikz 2010/10/13 v2.10 (rcs-revision 1.76) When I'm putting the '=' before of it gives me an error. Also when I have the '=' after of and write e.west it gives me an error. Should this be of the version I'm using? – gkaran89 Aug 9 '12 at 22:31
OK, for the second one I also has to use the positioning library. The first problem still holds though. – gkaran89 Aug 9 '12 at 22:38
I managed to get rid of the first problem as well. Apparently the problem was caused by the arguments I was using in the tikzpicture : \begin{tikzpicture}[node distance = 1.5cm, auto]. Thanks again for your help! – gkaran89 Aug 10 '12 at 7:17

Your Answer


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.