2

I want to achieve the following:

connected boxes

nesting

This is what I currently have: \mystrut is from here. usage of parbox is from here.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes,arrows}
\begin{document}

\def\mystrut{\vrule height 1.5cm depth 1.5cm width 0pt} 
\begin{tikzpicture}[mybox/.style={rectangle split, rectangle split parts=2, draw, text width=3.5cm,text centered}]

\node (AAA) [mybox]
        {
            \textbf{AAA}
            \nodepart{second}\mystrut some description
        };

\node (BBB) [right = of AAA,mybox]
        {
            \textbf{BBB}
            \nodepart{second}\mystrut \parbox{3.5cm}{\centering some longer description}
        };

\draw[transform canvas={yshift=0.5cm},-stealth](AAA) --(BBB);
\draw[transform canvas={yshift=-0.5cm},-stealth](BBB) --(AAA);

\end{tikzpicture}

\end{document}

current

How can I nest my boxes? I don't have to use rectangle split nodes, they just turned up as the first results in my search.

m.s.
  • 383

1 Answers1

3

Do you mean something like this:

enter image description here This picture (I follow to example shown in your question) is obtained by code:

\documentclass[tikz,border=2mm]{standalone}
    \usetikzlibrary{positioning,shapes,arrows}
\begin{document}
    \begin{tikzpicture}[
    node distance = 0mm,
every node/.style = {draw, text width=3.5cm, inner sep=2mm, 
                     outer sep=0mm, align=center},
headernode/.style = {font=\Large\bfseries},
  textnode/.style = {minimum height=30mm},
     mybox/.style = {rectangle split, rectangle split parts=2, 
                     font=\scriptsize, text width=13mm, align=center}
                        ]
\node (AA1) [headernode]                    {AAA};
\node (AA2) [below=of AA1,textnode]         {some description};
\node (BB1) [right=16mm of AA1,headernode]  {BBB};
\node (BB2) [below=of BB1,textnode]         {some longer description};
\node (DD1) [below=16mm of AA2,headernode]  {DDD};
\node (DD2) [below=of DD1,textnode]         {};

\draw[transform canvas={yshift= 0.5cm},-stealth](AA2) --(BB2);
\draw[transform canvas={yshift=-0.5cm},-stealth](BB2) --(AA2);
% nested boxes
\node (DAA) [above right=2mm of DD2.south west,mybox] 
    {AAA \nodepart{two} some description};
\node (DBB) [above  left=2mm of DD2.south east,mybox] 
    {BBB \nodepart{two} some description};

\draw[transform canvas={yshift=-0.1cm},-stealth](DAA) --(DBB);
\draw[transform canvas={yshift=-0.4cm},-stealth](DBB) --(DAA);
\end{tikzpicture}
    \end{document}

In above code I define (behind modified your mybox) two nodes: ``headernode, which contains (I suppose) a title of block and textnode which contains descrriitpin. For each are in style defined selected fonts and kind of alignment.

For nested nodes I use your mybox with smaller measures and fonts.

Zarko
  • 296,517