# Tikz for loop for nodes

How do I construct a for loop so that I get

\draw [step=0.5cm, gray!80] (0,0) grid (4,4);
\draw [orange] plot [only marks, mark size=2.5, mark=*] coordinates {(0,0) (4,4)};


at every intersection?

-
While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. –  Peter Grill Apr 5 '13 at 21:01
@PeterGrill My mistake. Thanks for letting me know. –  AlanH Apr 5 '13 at 21:06

Use a \foreach loop, with a step size of 0.5:

## Code:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw [step=0.5cm, gray!80] (0,0) grid (4,4);
\foreach \x in {0,0.5,...,4} {%
\foreach \y in {0,0.5,...,4} {%
\draw [orange] plot [only marks, mark size=2.5, mark=*]
coordinates {(\x,\y)};
}%
}%
\end{tikzpicture}
\end{document}

-