The answer is in the manual : 16.5.3 Advanced Placement Options (CVS version of pgfmanual but I think you can find this paragraph in the classic manual).
The example gives in the manual is : ((see Martin's answer)
\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{%
arrows,
positioning
}
\begin{document}
\begin{tikzpicture}[every node/.style=draw,scale=2]
\draw[help lines] (0,0) grid (2,2);
\node (some node) at (1,1) {some node};
\node (other node) [above=1cm of some node] {\tiny above=1cm of some node};
\draw [<->] (some node.north) -- (other node.south)
node [midway,right,draw=none] {1cm};
\end{tikzpicture}
\end{document}
Important :
When this library is loaded, the options like above or above left
behave differently. With the positioning library loaded, the above
option does not take a simple ⟨dimension⟩ as its parameter. Rather, it
can (also) take a more elaborate ⟨specification⟩ as parameter. This
⟨specification⟩ has the following general form: It starts with an
optional ⟨shifting part⟩ and is followed by an optional ⟨of-part⟩.
Remark :
You can instead use the distance between the nodes, use the distances between the centers : You need to do this use the option on grid
. The manual gives
\begin{tikzpicture}[every node/.style=draw]
\draw[help lines] (0,0) grid (2,3);
% Not gridded
\node (a1) at (0,0) {not gridded};
\node (b1) [above=1cm of a1] {fooy};
\node (c1) [above=1cm of b1] {a};
% gridded
\node (a2) at (2,0) {gridded};
\node (b2) [on grid,above=1cm of a2] {fooy};
\node (c2) [on grid,above=1cm of b2] {a};
\end{tikzpicture}
But another possibility is to use node distance
(see Frederic's answer).
The syntax is different above=of ...
\begin{tikzpicture}[every node/.style=draw,node distance=5mm]
\draw[help lines] (0,0) grid (2,3);
% Not gridded
\node (a1) at (0,0) {not gridded};
\node (b1) [above=of a1] {fooy};
\node (c1) [above=of b1] {a};
% gridded
\begin{scope}[on grid]
\node (a2) at (2,0) {gridded};
\node (b2) [above=of a2] {fooy};
\node (c2) [above=of b2] {a};
\end{scope}
\end{tikzpicture}
Last remark:
I don't like positioning
the first argument : I use Tikz from the first version and positioning
redefines some options. The second argument is : it's not easy to scale a picture that uses positioning
and node distance
.