[Tex/LaTex] arrows with tikz package

arrowstikz-pgf

I use tikz, and try draw a directed graph with

\begin{tikzpicture}                                                                  
\node[draw, circle] (1) {1};                                                         
\node[draw, circle] (2) [ right of=1] {2};                                           
                                                                                     
\path (1) edge (2);                                                                  
\end{tikzpicture}  

and get

ss

how I can get this ? (with arrow)

ss1

Edit

I try with

\path[->] (1) edge (2);

but I get

! Argument of \language@active@arg> has an extra }.
<inserted text> 
                \par 
l.403     \path[->] (
                     1) edge (2);

Best Answer

spanish babel's option declares < and > active characters to write something like <<Hello>> and obtain french quotes. This behavior clashes with TiKZ arrow form [->]. The way to deactivate <> is \usepackage[spanish,es-noquoting]{babel}, so

\documentclass{article}
\usepackage{tikz}
\usepackage[spanish,es-noquoting]{babel}
\begin{document} 
\begin{tikzpicture}                                                                  
\node[draw, circle] (1) {1};                                                         
\node[draw, circle] (2) [ right of=1] {2};                                           

\path[->] (1) edge (2);                                                                  
\end{tikzpicture}
\end{document}

works as expected. I've found this solution in CervanTeX (spanish TUG) forums:

Update for TiKZ 3.0

TiKZ 3.0 includes a new babel library (pgfmanual section 42) which avoid this kind of problems. Using it, is not necessary to use es-noquoting option any more. You can even have spanish quotes inside nodes.

\documentclass{article}
\usepackage[spanish]{babel}
\usepackage{tikz}
\usetikzlibrary{babel,positioning}

\begin{document}

\begin{tikzpicture}                                                                  
\node[draw, circle] (1) {<<1>>};                                                         
\node[draw, circle] (2) [ right = of 1] {<<2>>};                                           

\path[->] (1) edge (2);                                                                  
\end{tikzpicture}

<<Hola>>
\end{document}

enter image description here