[Tex/LaTex] Making a square centered at a point in TikZ

tikz-pgf

Im a newbie to TikZ, so this question may seem stupid.
Im a looking at a facility location problem in the plane where I have generated some data points consisting of (x,y)-coordinates for each customer node and each facility node. In the literature, customers nodes are usually marked by a circular dot so I have used the notation

\draw [fill] (x,y) circle [radius=0.05]; 

for some point specified by (x,y).

The facility nodes are usually marked with a small square. But how do I create a square centered at the point (x,y)? I have looked at rectangle function. But as I have the center point, this approach does not seem to be the right way to go. Can anyone help me here?

Best Answer

To complete Jake's answer, other possibilities are :

\documentclass{article}
\usepackage{tikz}    
\begin{document}

 \begin{tikzpicture}
   \newcommand\Square[1]{+(-#1,-#1) rectangle +(#1,#1)}
   \draw [very thin, lightgray] (0,0) grid (4,4);  
     \draw (2,3) +(-2pt,-2pt) rectangle +(2pt,2pt) ;
     \draw (2,3) \Square{12pt} ;    
 \end{tikzpicture}    
\end{document}

enter image description here

You can use a node and also a coordinate like this

\begin{tikzpicture} [dot/.style={draw,rectangle,minimum size=4mm,inner sep=0pt,outer sep=0pt,thick}]
  \draw [very thin, lightgray] (0,0) grid (4,4);
  \path (1,1) coordinate[dot] ;  
\end{tikzpicture} 

enter image description here

With a node :

  \node [rectangle,minimum size=4mm,inner sep=0pt,outer sep=0pt,thick] at (1,1) {};