5

I'm trying to create a TikZ flowchart where I need to differentiate between serial and parallel streams. Here's an example with serial to parallel:

serial to parallel nodes

I've managed to create a multiple stack of rectangles, but struggle to centre text and it can't be incorporated as a node shape. I could always manually draw it all, but I'm wondering whether there's an easier way to accomplish this? Particularly, is there a way to create a TikZ style with multiples overlaid rectangles that could easily be incorporated into nodes?

Here's my code, which recreates the bottom rectangle, with poorly centred text:

\newcommand{\pstack}[3]{
\draw[fill=white, minimum height=4em] #1 rectangle #2;
\draw[fill=white, minimum height=4em] #1 ++(-0.05,0.05) ++(-0.05,0.05) rectangle +#2;
\draw[fill=white, minimum height=4em, thick] #1 ++(-0.1,0.1) ++(-0.1,0.1) rectangle +#2;
\path #1 -- +#2 node[pos=0.75] {#3};
}
\begin{tikzpicture}[node distance = 2cm, auto]%[scale=.8, z={(-.707,-.3)}]
    \pstack{(0,0)}{(2,1)}{some text};
\end{tikzpicture}
7

You can use double copy shadow from shadows tikz library.

An example:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows,positioning,calc}
\tikzset{multiple/.style = {double copy shadow={shadow xshift=1ex,shadow
         yshift=-1.5ex,draw=black!30},fill=white,draw=black,thick,minimum height = 1cm,minimum
           width=2cm},
         ordinary/.style = {rectangle,draw,thick,minimum height = 1cm,minimum width=2cm}}
\begin{document}

\begin{tikzpicture}
   \node [ordinary] at (0,0) (a) {Some};
   \node [multiple,below=3cm of a] (b) {Text};
   \draw[-latex] (a) -- coordinate (ab) (b);
   \draw (ab) -- ++(0.7,-0.5)coordinate[pos=.3](ab1) coordinate[pos=.6](ab2);
   \draw[-latex] (ab1) -- ($(b.north west)!(ab1)!(b.north east)$);
   \draw[-latex] (ab2) -- ($(b.north west)!(ab2)!(b.north east)$);
\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.