[Tex/LaTex] Code compilation problem – example on Tikz vectors

errorstikz-pgfvector

I would like to use the following code segment:

Code

\usetikzlibrary{arrows}
\usetikzlibrary{calc}

\begin{tikzpicture}[line/.style={>=latex}] 
\coordinate (V1) at (1, 1.3);
\coordinate (V2) at (-1.6, 0.4);
\coordinate (V3) at ($(V1) + (V2)$);
\coordinate (V4) at ($1.4*(V1)$);

\draw[step=10pt, color=black!10] (-2, -1) grid (2, 2);
\draw[<->, line] (-2, 0) -- node [below, very near end] {$x$} (2, 0);
\draw[<->, line] (0, -1) -- node [right, very near start] {$y$} (0, 2);
\draw[->, line, color=orange, thick] (0, 0) -- node [right=2pt, near end]    {$\vec{u}$} (V4);
\draw[->, line, color=blue, thick, densely dashed] (0, 0) -- node [right=2pt] {$\vec{v}$} (V1);

\draw[->, line, color=red, thick] (0, 0) -- node [above] {$\vec{w}$} (V2);
\draw[->, line, color=red, densely dotted] (V1) -- +(V2);
\draw[->, line, color=blue, densely dotted] (V2) -- +(V1);
\draw[->, line, color=green!70!black, thick] (0, 0) -- node [left] {$\vec{z}$} (V3);
\end{tikzpicture}

which is taken from
the following link, yet the code does not compile for me and give a different criptic error for each Tex editor I try.

Help is appreciated.

Best Answer

Change all those accidentally copied HTML codes &lt; and &gt; to < and >, respectively. Then the code becomes (completed):

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}[line/.style={>=latex}] 
\coordinate (V1) at (1, 1.3);
\coordinate (V2) at (-1.6, 0.4);
\coordinate (V3) at ($(V1) + (V2)$);
\coordinate (V4) at ($1.4*(V1)$);

\draw[step=10pt, color=black!10] (-2, -1) grid (2, 2);
\draw[<->, line] (-2, 0) -- node [below, very near end] {$x$} (2, 0);
\draw[<->, line] (0, -1) -- node [right, very near start] {$y$} (0, 2);
\draw[->, line, color=orange, thick] (0, 0) -- node [right=2pt, near end]    {$\vec{u}$} (V4);
\draw[->, line, color=blue, thick, densely dashed] (0, 0) -- node [right=2pt] {$\vec{v}$} (V1);

\draw[->, line, color=red, thick] (0, 0) -- node [above] {$\vec{w}$} (V2);
\draw[->, line, color=red, densely dotted] (V1) -- +(V2);
\draw[->, line, color=blue, densely dotted] (V2) -- +(V1);
\draw[->, line, color=green!70!black, thick] (0, 0) -- node [left] {$\vec{z}$} (V3);
\end{tikzpicture}
\end{document}

and works fine with the result:

Output of the TikZ drawing