2

I'm using an existing tikz example to create a flow chart of sorts, showing how applications and libraries communicate with each other in a software project. For example, the following image depicts two applications (ie: peers) communicating directly with each other:

enter image description here

What I would like to do with tikz is to create a new type of element which consists of a square element with another square inside of it. I would use this to depict something similar to the above, but it implies that "Process A" requires the use of "Library B_API" to talk to "Process B".

enter image description here

How would I accomplish this with tikz?

Thank you.

3
\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{shapes,arrows,calc}

\tikzstyle{application} = [rectangle, fill=blue!30, text centered, text width=3cm, minimum width=4cm, minimum height=4cm]
\tikzstyle{library} = [rectangle, fill=green!50, text centered, minimum width=3cm, minimum height=2cm, text width=2cm]

\begin{document}
\begin{tikzpicture}[node distance = 2cm, auto]

\node[application, label={[yshift=-14mm]Process A}] (AppA) at (0,0) {};
\node[application] (AppB) at (5,0) {Process B};
\node[library] (LibB) at (0,-.5) {Library B\_API};

\draw[<->,>=latex] (LibB.east) -- ($(LibB.east)+(1,0)$) -- ($(AppB.west)-(.5,0)$) -- (AppB.west);

\end{tikzpicture}
\end{document}

enter image description here

1

It has been a nice exercise: an empty node with an inner labelled label.

\documentclass[tikz,border=2mm]{standalone} 
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}[external/.style={fill=blue!40, minimum size=3cm},
    internal/.style={fill=green!30, text width=1.5cm, 
          minimum height=1.5cm, minimum width=2cm, align=center}]

\node[external, label={[internal, label=above:Process A, name=api, 
          yshift=.5cm, anchor=south]270:{Library\\ B\_API}}] (A) {};
\node[external, right= of A] (B) {Process B};
\draw[<->] (api.east)--++(0:1cm)|- (B);
\end{tikzpicture}
\end{document}

enter image description here

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.