# Position of nodes in TikZ matrix

I would like to be able to put a comment below an element in the last row of a TikZ matrix. I thought that the MWE below would allow me to do that, but it does not. To be specific, I thought the MWE below would print "hello" below element 9.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix
{
\node {8}; &[2mm] \node{1}; &[-1mm] \node {6}; \\
\node {3}; &      \node{5}; &       \node {7}; \\
\node {4}; &      \node(a){9}; &    \node {2}; \\
};
\node (a.south) {hello};
\end{tikzpicture}
\end{document}


How can I get this to work?

-

Using \node [below] at (a.south) {hello} works. Without the at you are defining a new node named (a.south).

## Why no error message?

• Leaving out the at does not generate an error as it is perfectly valid syntax. So,

 \node (X) {text 1};


defines a coordinate named (X) at the current location, and

 \node at (Y) {text 2};


places the given text at the coordinate named (Y).

In your specific example, the first use of \node (a) {9} was defining a coordinate named (a) at the point where the node containing the text 9 is located. Your second use (where you were trying to place hello) was defining a coordinate named (a.south) without explicitly specifying where you wanted this node placed.

## Code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix
{
\node {8}; &[2mm] \node{1}; &[-1mm] \node {6}; \\
\node {3}; &      \node{5}; &       \node {7}; \\
\node {4}; &      \node(a){9}; &    \node {2}; \\
};
\node  [below] at (a.south) {hello};
\end{tikzpicture}
\end{document}

-
Thanks. Why is the "at" necessary - or put another way - why does a missing "at" not lead to an error? – user1362373 Feb 10 '14 at 18:19
@user1362373: Have updated answer. Please let me know if that clarifies things. – Peter Grill Feb 10 '14 at 18:48
Got it, thanks for the clarification. – user1362373 Feb 10 '14 at 19:00