I'm trying to visualize and describe the steps of the process with a TikZ flowchart. I would like to make the solution as scalable as possible, it would be perfect to have some data structure associated with each step of the process based on which the flowchart would be created. Something similar to the list:

   \item[short_description, output, long_details]
   \item[short_description, output, long_details]

That would result in something like this:

enter image description here

Ideally with flowchart wrapping (but let's solve the problem one step at a time...)

So far I was able to sort out the plotting of a single-line sequence of connected blocks, but I am stuck trying to introduce some data structure over which to iterate. What would be the best approach to build this kind of data structure in TeX?


\usepackage[a4paper, margin={1in}]{geometry}

\usetikzlibrary{shapes.geometric, arrows}

\tikzstyle{block} = [rectangle, minimum width=2cm, minimum height=1cm, align=center, text centered, text width=2cm, draw=black]
\tikzstyle{arrow} = [thick,->,>=stealth]


\begin{tikzpicture}[node distance=1cm]

% Create a sequence of blocks  with arrows
\foreach \x [remember=\x as \lastx (initially 0)] in {0,...,5}{
        \node (n\x) [block]  {n\x};
        \node (n\x) [block, right = of n\lastx]  {n\x};
        \draw [arrow] (n\lastx) -- (n\x) node[midway, above]() {$s(\lastx)$};



Long description:
    \item [n0] Long description of what n0 does
    \item [n1] Long description of what n1 does



1 Answer 1


I'm not sure if this is exactly what you want, but here is a possibility using the chains library. Define a macro \process that takes a comma-separated list for an argument. Each entry should have the form <short desc>/<input>/<long description>. Note that the arrows are input arrows, not output arrows, so the first is ignored. It was easier to do it this way because of the way the join option works with chains.

The first chain is the flowchart with joins; the second has the descriptions.

enter image description here


\usetikzlibrary{chains, arrows.meta, quotes}

\tikzset{block/.style={draw, minimum width=2cm, minimum height=1cm}}

    \begin{tikzpicture}[start chain=1, start chain=2, node distance=1mm and 1cm,
            every join/.style={thick, -Stealth}]
        \node[on chain=2] at (-1,-.7){}; 
        \foreach \S/\O/\L in {#1}{
            \node[on chain=1, block, join=by "\O"]{\S};
            \node[on chain=2 going {below=of \tikzchainprevious.south west, anchor=north west}]{\S\;\L};


    n0/ignored/Long description of what n0 does,
    n1/$s(0)$/Long description of what n1 does,
    n2/$s(1)$/Long description of what n2 does,
    n3/$s(2)$/Long description of what n3 does


You must log in to answer this question.

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