# tikzpicture in newcommand

I define this command

\newcommand{\exercice}[3]{
{\bf Exercice #1.} {#2}

\bigskip{\textit{\underline{Solution}.}} #3

\begin{center}------------------------------------
\end{center}

}


and then I use the tikz library

\exercice
{6}
{The graph:
\begin{figure}[h]
\centering
\shorthandoff{<>} %To avoidinterference with Babel
\begin{tikzpicture}[scale=1,>=stealth,thick,estilo/.style={circle,draw,inner sep=0.5mm,fill=gray!50},theshift/.style={xshift=9cm,yshift=0cm}]

\node[estilo] (node1) at (0,0) {1};
\node[estilo] (node2) at (4,2) {2};
\node[estilo] (node3) at (4,-2) {3};
\node[estilo] (node4) at (8,0) {4};
\draw[->] (node1) node[left]{$[3]\$} -- node[left]{$\ (0,3,5)\$} (node2);
\draw[->] (node2) to [bend right=30] node[left]{$\ (0,1,2)\$} (node3);
\draw[->] (node3) to [bend right=30] node[right]{$\ (0,1,2)\$} (node2);
\draw[->] (node1) -- node[left]{$\ (1,3,2)\$} (node3);
\draw[->] (node2)  -- node[right]{$\ (1,2,-1)\$} (node4) node[right]{$\ [-3]$};
\draw[->] (node3) -- node[right]{$\ (0,5,3)\$} (node4);

\end{tikzpicture}
\shorthandon{<>} %To avoidinterference with Babel
\end{figure}
}
{
}


and I obtained this error

"Argument of \language@active@arg> has an extra }"

This fails for the same reason that you can not have verbatim in the argument of a command

\shorthandoff{<>} %To avoidinterference with Babel


would make <> not be active but since they have already been read as the argument of your command then the tokens are already relating to the active character and it is too late to change that.

Unrelated but note that in

The graph:
\begin{figure}[h]


that figure is a floating environment so may float to another page, which would leave nothing following the colon. It is best to always refer to figures by the caption number.