I'm very new to this so bare with me. To get the hang of macros I wanted to write a simple command to draw a square in tikz. Now I know there are a lot of ways to do this, but I want to be able to write more difficult macros.
My code below:
\documentclass{article}
\usepackage{calc}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{shapes.geometric}
\newcommand{\tikzsquare}[2]{
\fill[blue!40!white, opacity=0.5] (#1, #2) rectangle (#1 + 2, #2 + 2);
}
\begin{document}
\begin{center}
\begin{tikzpicture}
\draw[step=1cm,gray,very thin] (-2,-2) grid (4,4);
\tikzsquare{0,0}
\end{tikzpicture}
\end{center}
\end{document}
What I would have expected was something like this:
Instead I got this error:
...
[Loading MPS to PDF converter (version 2006.09.02).]
)
! Argument of \XC@definec@lor has an extra }.
<inserted text>
\par
l.14 \end
{tikzpicture}
?
Runaway argument?
{pgfstrokecolor}{)}\ifx \reserved@a \@currenvir \else \@badend {)}\fi \ETC.
! Paragraph ended before \XC@definec@lor was complete.
<to be read again>
\par
l.14 \end
{tikzpicture}
?
! LaTeX Error: \begin{tikzpicture} on input line 11 ended by \end{+}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.14 \end
{tikzpicture}
Any help would be very much appreciated

\tikzsquare{0,0}you should use\tikzsquare{0}{0}. Every parameter in its own pair of braces. – Ignasi Mar 16 '16 at 14:33commandsI'd suggest usingpicsfor more complex macros. Examples: http://tex.stackexchange.com/questions/126161/how-can-i-draw-a-tikz-element-multiple-times-against-a-shaded-background/151772#151772 – Ignasi Mar 16 '16 at 14:35