array.tex 833 B

1234567891011121314151617181920212223242526
  1. \documentclass{article}
  2. \usepackage[pdftex,active,tightpage]{preview}
  3. \setlength\PreviewBorder{2mm}
  4. \usepackage{tikz}
  5. \usetikzlibrary{shapes.multipart, calc}
  6. \begin{document}
  7. \begin{preview}
  8. \begin{tikzpicture}[array/.style={rectangle split,rectangle split horizontal, rectangle split parts=#1,draw, anchor=center, fill=white}]
  9. \node[array=5] (a) {
  10. \nodepart{one}d
  11. \nodepart{two}
  12. \nodepart{three}c
  13. \nodepart{four}c
  14. \nodepart{five}b
  15. };
  16. \node[color=gray, anchor=north, yshift=-0.5] at (a.one) {\tiny $0$};
  17. \node[color=gray, anchor=north, yshift=-2] at (a.two) {\tiny $1$};
  18. \node[color=gray, anchor=north, yshift=-2] at (a.three) {\tiny $2$};
  19. \node[color=gray, anchor=north, yshift=-2] at (a.four) {\tiny $3$};
  20. \node[color=gray, anchor=north, yshift=-0.5] at (a.five) {\tiny $4$};
  21. \end{tikzpicture}
  22. \end{preview}
  23. \end{document}