I would like to draw self contained boxes to express hierarchy? I would like to draw the following image, I know how to draw the small boxes (A,B,C) using Tikz:

\tikzstyle{block} = [rectangle, draw, text centered]
\begin{tikzpicture}[node distance = 2cm, auto]
    \node [block, thick] (init) {initialize model};
    \node [block,thick, right of=init,node distance=3cm] (system) {system};
    \draw [->, ultra thick] (init) -- (system);

But I don't know how to draw the big boxes (System general & special).snapshot

  • Welcome to TeX.SX! You might try something like \draw (0,0) rectangle (5,5) (adjust to your needs). Please help us help you by providing a minimal compilable code example (MWE). – TeXnician Sep 1 '18 at 17:06
  • Thanks so much! But how do you specify the location of the text please? – user169547 Sep 1 '18 at 17:25
  • Simply create another node (with draw=none). – TeXnician Sep 1 '18 at 17:32

the following code recreate image provided in your question:

\documentclass[tikz, margin=3mm]{standalone}

node distance = 8mm and 4mm,
 block/.style = {rectangle, draw, thick,
                 text width=12mm, align=center},
   FIT/.style = {rectangle, draw, thick, inner ysep=12mm, inner xsep=6mm,
   arr/.style = {-Stealth, ultra thick},
         font = \sffamily\bfseries
\node [block]               (a) {A};
\node [block,below=of a]    (b) {B};
\node [FIT=(a) (b)] (ssys) {};
    \node[below right=0mm of ssys.north west] {System special};
\node [block, below left=of ssys] (c) {C};
\node [FIT=(ssys) (c)] (gsys) {};
     \node[below right=0mm of gsys.north west] {System general};
\draw [arr] (c.north) -- (b.south);
\draw [arr] (b) -- (a);

enter image description here

in code i use tikz libraries arrows.meta (for arrows), fit (for nodes "system special" and "system general") and positioning for positioning of nodes in image.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy