# How to use the Tikz with Latex

I want to draw a coordinate system and/or Grid lines like this:

I'm a LaTeX beginner and am not sure how I can use as a package to draw it.

Can anyone recommend a latex package for it?

• You mention tikz, but have you tried it yet? The documentation can be intimidating, but it contains many useful tutorials. – erik Nov 14 '16 at 15:03
• Maybe cremeronline.com/LaTeX/minimaltikz.pdf could be helpfull. – samcarter_is_at_topanswers.xyz Nov 14 '16 at 15:05
• Or "2.7 Grid Path Construction" from mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf – samcarter_is_at_topanswers.xyz Nov 14 '16 at 15:06
• – Torbjørn T. Nov 14 '16 at 15:14
• @Achaire, I think this is a very good example to learn TikZ. I agree with the others. Have a look at the tutorials in the tikzmanual to get knowledge of "how to think" when you want to draw something (because there are many ways to get the desired result, but some of them are better/shorter than others). When you know how to design the image, then it is just scrolling in the manual to find out how to draw the it. When you have drawn something you are welcome to edit your question and post your code there. Then we will be happy to help you. – Stefan Pinnow Nov 14 '16 at 17:12

## 1 Answer

You can utilize Tikz to achieve the image you've posted. See the result below

The code for the preceding output is

\documentclass[border={10pt}]{standalone}

\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}
[%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dot/.style={circle,draw=black, fill,inner sep=1pt},
line/.style={-latex,thick}
]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\draw[step=1cm,gray,dashed] (-1,-1) grid (7,7);

\foreach \x in {0,...,6}{
\foreach \y in {0,...,6} {
\node[dot] at (\x,\y){ };
}}
\draw[line,green] (0,2) -- node[above,xshift=-2mm]{$u_2$}(1,4);
\draw[line,green] (0,2) -- node[above,xshift=-1mm]{$u_1$}(3,4);
\draw[line,red] (3,1) -- node[left]{$v_2$}(3,2);
\draw[line,red] (3,1) -- node[below]{$v_1$}(4,1);
\end{tikzpicture}

\end{document}

• (+1) One detail: ->,-latex is a bit more than necessary, just -latex is enough. You could also say ->,>=latex, where the first part says to add an arrow tip, while the second says set default arrow tip to latex. – Torbjørn T. Nov 14 '16 at 20:53
• @TorbjørnT., nice catch. I will update it. – CroCo Nov 14 '16 at 20:55