I want to make something like the following image in tikz:


To be able to do this, I would need to, essentially double nest nodes. I saw this post about nesting nodes: Nested TikZ nodes. The solution in that post uses matrices, which, according to: In TikZ, is it possible to nest matrices? is not possible. Also, there is the arrows, not sure where to even start with that, that is probably gonna depend on the implementation of the double nested nodes I guess.

So, I was wondering if it is possible to create that image, or something similar through tikz.

1 Answer 1


Welcome to TeX.SX! Don't nest nodes, rather use backgrounds and have a look at the fit library (which has already been mentioned in one of the linked answers):

\usetikzlibrary{fit, backgrounds, positioning}

    every node/.style={
        inner sep=10pt,



    \pgfdeclarelayer{background layer}
    \pgfsetlayers{background layer,main}

    \node (one) {Text};
    \node[below=.5cm of one] (two) {Text};
    \node[below=.5cm of two] (three) {Text};

    \node[above=.5cm of one, draw=none] (four) {Text};

    \node[fit={(three) (one)}] (wrap three) {};

    \begin{pgfonlayer}{background layer}
        \node[fit={(wrap three) (four)}, fill=blue!25] (wrap four) {};



enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .