A rectangle label does not appear inside the rectangle but on the corner of it.
\tikzstyle{every node} = [align=center]
\begin{tikzpicture}
\draw (0, 0) rectangle (2, 2) node [center] {label};
%center is unknown but was my best guess
\end{tikzpicture}
How do I move the labelling node to have a common center with the rectangle?
The result should look like this
\tikzstyle{every node} = [align=center]
\begin{tikzpicture}
\draw (0, 0) rectangle (2, 2);
\node at (1,1) {label};
\end{tikzpicture}
but without having to specify the center manually.
Best Answer
You should write instead:
By using
node
in a path without option, it will position the node to the last point.