3

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.

7

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

\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{shapes,fit,arrows,calc}

\begin{document}

\begin{tikzpicture}
\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)$);
\end{tikzpicture}

\end{document}

enter image description here

  • 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 – George Karanikas 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? – George Karanikas 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. – George Karanikas 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! – George Karanikas Aug 10 '12 at 7:17

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.