\documentclass{article} \usepackage[pdftex,active,tightpage]{preview} \setlength\PreviewBorder{2mm} \usepackage{tikz} \usetikzlibrary{shapes.multipart, calc} \begin{document} \begin{preview} \begin{tikzpicture}[array/.style={rectangle split,rectangle split horizontal, rectangle split parts=#1,draw, anchor=center, fill=white}] \node[array=5] (a) { \nodepart{one}d \nodepart{two} \nodepart{three}c \nodepart{four}c \nodepart{five}b }; \node[color=gray, anchor=north, yshift=-0.5] at (a.one) {\tiny $0$}; \node[color=gray, anchor=north, yshift=-2] at (a.two) {\tiny $1$}; \node[color=gray, anchor=north, yshift=-2] at (a.three) {\tiny $2$}; \node[color=gray, anchor=north, yshift=-2] at (a.four) {\tiny $3$}; \node[color=gray, anchor=north, yshift=-0.5] at (a.five) {\tiny $4$}; \end{tikzpicture} \end{preview} \end{document}