I create a picture of array which consists of nodes. I wonder how I can set the font size for the label which is below every cell (for example make it as scriptsize). This are my definitions:

  \foreach [count=\i from 0] \j  in {1,...,#1} {
    \node[cell,label=below:\i] (cell\i) at (\i*0.5,0) {};

  cell/.style = {draw, minimum width=0.5cm, minimum height=0.5cm, minium size = 0.5cm}

enter image description here

  • 2
    Why does your \cells command take seven arguments when you only use one? Sep 13, 2014 at 13:09

4 Answers 4


Just add \scriptsize:

\node[cell,label=below:{\scriptsize \i}]

You can change the font or whatever in the same way.

  • I didn't expected it will be so easy. Thanks!
    – Ziva
    Sep 12, 2014 at 21:13

I know it's more tedious for this simple example, but for educational purposes it might be interesting to see how to add proper TikZ styles to the label:

\node[cell,label={[font=\small, red, rotate=20]below:\i}]

Note that the braces around the value in label={[]stuff} are necessary.


A PSTricks solution:


\psset{dimen = m}


\def\cells{11} % number of cells
  \multido{\r = 0.5+1, \i = 0+1}{\cells}{%
    \psframe(!\r\space 0.5 sub 0.4)(!\r\space 0.5 add 1.4)
    \rput(\r,0.1){\scriptsize $\i$}}



  • 7
    I like to imagine the people posting "A PSTricks Solution" answers to TikZ questions to be brave warriors, vigorously fighting their last stand against the horde of TiKZ questions flooding the realms of TeX.SX. I know it's silly, but your Viking avatar just fits perfectly into this scenario. :-D +1
    – Fritz
    Sep 13, 2014 at 23:17

Just 4 fun with PSTricks.


    \foreach \i in {0,...,10}{\rput(\i,.5){\psframe(1,1)\rput(.5,.5){0}\uput[-90](.5,0){\i}}}

enter image description here

You must log in to answer this question.

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