I need a figure like this (four vertically stacked rectangles with text; the two numbers in the texts are different and don't follow a pattern):
What I did:
%working
\documentclass{standalone}
\usepackage{tikz,amsmath}
\newcommand{\vrect}[2]{ %%% Need to pass an array of 4 arguments
\foreach \pos [count=\i] in {{(0,-4)},{(0,-3)},{(0,-2)},{(0,-1)}}{
\node[draw=black,thick,minimum size=1cm] (z\i) at \pos {Val#1#2};
}
}
\begin{document}
\begin{tikzpicture}[scale=1]
%%\vrect{{1,1}, {3,5}, {8,7}, {1,0}}} %% How to use this?
\vrect{1}{1}
\end{tikzpicture}
\end{document}
I don't really know
- how to pass an array as an argument
- how to access arguments based on the index (tried
#\iwith failure)
Any help is appreciated.
P.S. I need to draw few figures like this, so I created a \newcommand.





rectangle splitnode, no loop will be needed. – Torbjørn T. Sep 08 '17 at 10:54