4

I want it to look like this in the end:

enter image description here

At the moment the rectangles in the back still got the text and idk how to make them the right size without having the text in them.

\documentclass[
    %draft, % Mit % kommentieren, um Bilder sichtbar zu machen und Links zu aktivieren
    pdftex,
    a4paper,
    oneside,
    parskip,
    numbers=noenddot,
    listof=totoc,
    bibliography=totoc,
    hyperfootnotes=false
]{scrreprt}
\setuptoc{toc}{totoc}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}

\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}
    \tikzset{rectangle node/.style={draw, minimum size=1cm}}
    
    \node[rectangle node] (scl) at (0,0) {SCL Contract};
    \node[rectangle node, right of=scl, node distance = 5cm] (ptg){PlainTextGen};
    \node[rectangle node,right of=ptg, node distance = 5cm, align=right] (sol) {Solidity Code \\.sol};
    \node[rectangle node,below of=sol, node distance = 2cm, align=right, on top of=solLib1] (solLib) {Solidity Libraries \\.sol};
    \node[rectangle,draw, align=right,on top of=solLib2] (solLib1) at (10.1,-1.9) {Solidity Libraries \\.sol};
    \node[rectangle,draw, align=right] (solLib2) at (10.2,-1.8) {Solidity Libraries \\.sol};
    
    \draw [->] (scl) -- (ptg);
    \draw [->] (ptg) -- (sol);
    \draw [->] (sol) -- (solLib);
\end{tikzpicture}
\caption{Code Generation Prozess}
\label{fig:CodeGenProzess}
\end{figure}
\end{document}
3

2 Answers 2

3

Like this?

enter image description here

In your case is simple with use double copy shadow from shadows TikZ library.

Off-topic: for positioning of nodes I would use positioning library and its sintay ...=of <node nameY>, which define distance between nodes borders:

\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                positioning,
                shadows}

\begin{document}
    \begin{tikzpicture}[
node distance = 4mm and 8mm,
     N/.style = {draw, fill=white, minimum size=1cm, align=right},
   dcs/.style = {double copy shadow, shadow xshift=2pt, shadow yshift=-2pt},
every edge/.append style = {draw, semithick, -Stealth}
                        ]
\node[N] (scl)  {SCL Contract};
\node[N, right=of scl]  (ptg)       {PlainTextGen};
\node[N, right=of ptg]  (sol)       {Solidity Code \\.sol};
\node[N, below=of sol, 
      dcs]              (solLib)    {Solidity Libraries \\.sol};
%
\draw   (scl) edge (ptg)
        (ptg) edge (sol)
        (sol) edge (solLib);
    \end{tikzpicture}
\end{document}
2

Maybe a little overkill.

Here is a method to draw on the back layer, with fit library to calculate the size, and insert two rectangles at the bottom. (Credit to this answer that enables the drawing on the bottom stack.)

\documentclass{article}
\usepackage{tikz}
\usepackage{xpatch}
\usetikzlibrary{shapes.geometric, arrows, positioning, fit, backgrounds}

% https://tex.stackexchange.com/a/562606/234654
\makeatletter
% similar to env "pgfonlayer", but the latest contents are typeset on
% lowest bottom (on reversed order)

\let\pgfonlayerreversed\pgfonlayer
\let\endpgfonlayerreversed\endpgfonlayer

\xpatchcmd\pgfonlayerreversed
  {\expandafter\box\csname pgf@layerbox@#1\endcsname\begingroup}
  {\begingroup}
  {}{\fail}

\xpatchcmd\endpgfonlayerreversed
  {\endgroup}
  {\endgroup\expandafter\box\csname pgf@layerbox@\pgfonlayer@name\endcsname}
  {}{\fail}


\tikzset{
  on background layer reversed/.style={%
    execute at begin scope={%
      \pgfonlayerreversed{background}%
      \let\tikz@options=\pgfutil@empty
      \tikzset{every on background layer/.try,#1}%
      \tikz@options
    },
    execute at end scope={\endpgfonlayerreversed}
  }
}


\def\StartDrawOnBottomOfLayerStack{%
  \scope\relax
  % patch \path variants to auto insert "\scoped[on lowest layer]"
  % currently \node, \pic, \coordinate, and \matrix are patched
  \let\tikz@path@overlay\tikz@path@overlay@autoscoped
  \let\tikz@path@overlayed\tikz@path@overlayed@autoscoped
}

\def\EndDrawOnTopOfLayerStack{%
  \endscope
}

\def\tikz@path@overlay@autoscoped#1{%
  \let\tikz@signal@path=\tikz@signal@path% for detection at begin of matrix cell
  \pgfutil@ifnextchar<%
    {\tikz@path@overlayed{#1}}
    {\scoped[on background layer reversed] \path #1}}%
\def\tikz@path@overlayed@autoscoped#1<#2>{%
  \scoped[on background layer reversed] \path<#2> #1}%
\makeatother

\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}
    \tikzset{rectangle node/.style={draw, minimum size=1cm}}

    \node[rectangle node, align=right] (sol) {Solidity Libraries \\.sol};

    \node[rectangle node, align=right,below=8mm of sol, fill=white] (solLib) {Supported Libraries \\.sol};

    \StartDrawOnBottomOfLayerStack
        \node [rectangle node, fit=(solLib), inner sep=0, xshift=1mm, yshift=1mm, fill=white] {};
        \node [rectangle node, fit=(solLib), inner sep=0, xshift=2mm, yshift=2mm] {};
    \EndDrawOnTopOfLayerStack

    \draw [->] (sol) -- (solLib);
    
\end{tikzpicture}
\caption{Code Generation Prozess}
\label{fig:CodeGenProzess}
\end{figure}
\end{document}

Result

1
  • Maybe a little overkill. Well, maybe ;)
    – SebGlav
    Jan 31 at 16:18

You must log in to answer this question.

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