EDIT: while researching TikZ/PGF I have found there are similar tools like: MetaPost, Asymptote, PSTricks and Sketch.
 \documentclass{article}
 \usepackage{tikz}
 \begin{document}
 Test diagram:\\
 \begin{tikzpicture}
 \end{tikzpicture}
 \end{document}
 We want to use the TikZ/PGF package so we have to tell LaTeX to use the package.
 I usually include some text as a kind of place holder.
 To start a diagram we invoke/create the the {tikzpicture} environment.
Drawing Some Primitives:
Now, we will start simple and draw two lines to act as our xy Cartesian axis:
 \begin{tikzpicture}
 \draw (1,0) — (1,0);
 \draw (0,1) — (0,1);
 \end{tikzpicture}
This produces the following result. Its not overly fancy, but its a start.
 From this example we have learnt that we can use the \draw command to create a line/path from point (x1, y1) to (x2, y2).
 “–” is actually a path extension operator which extends a path from one point to another. For example, we could draw a square like this: \draw (1,1) — (1,1) — (1,1) — (1,1) — (1,1);
p, li { whitespace: prewra
 \begin{tikzpicture}
 \draw (1,0) — (1,0);
 \draw (0,1) — (0,1);
 \draw (0.5,0.5) circle (0.5);
 \filldraw [gray] (0.5,0.5) circle (0.5);
 \draw (0.5,0.5) ellipse (0.5 and 0.25);
 \end{tikzpicture}
This produces the following result:
 Here we can draw a circle at (x,y) and specify a radius.
 The command to fill is also introduced; instead of \draw, we use \filldraw followed by the colour of the fill.
 We can also draw an ellipse by specifying two radii.
Adding a Grid:
 \begin{tikzpicture}
 \draw (1,0) — (1,0);
 \draw (0,1) — (0,1);
 \draw (0,0) circle (0.8);
 \draw[step=0.1] (0,0) grid (1,1);
 \end{tikzpicture}
This produces the following result:
 Here we have drawn a grid from (x1, y1) to (x2, y2) with a step of 0.1. A unique step can be defined for the x and y directions using xstep and ystep, but we don’t want that in this scenario.
 \begin{tikzpicture}
 \draw (1,0) — (1,0);
 \draw (0,1) — (0,1);
 \draw (0,0) circle (0.8);
 \draw[step=0.2] (1,1) grid (1,1);
 \end{tikzpicture}
This produces the following result:
 \begin{tikzpicture}
 \draw[step=0.2, gray, very thin] (1,1) grid (1,1);
 \draw (1.2,0) — (1.2,0);
 \draw (0,1.2) — (0,1.2);
 \draw (0,0) circle (0.8);
 \end{tikzpicture}
Here is the result:
That’s looking better!
TikZ Styles and introducing Colour:
 \tikzstyle gridstyle = [style=help lines, color=blue!40]
 \begin{document}
 Test diagram:\\
 \begin{tikzpicture}
 \draw[step=0.2, style=gridstyle] (1,1) grid (1,1);
 \draw (1.2,0) — (1.2,0);
 \draw (0,1.2) — (0,1.2);
 \draw (0,0) circle (0.8);
 \end{tikzpicture}
 \end{document}
 The first thing we see is how to define a style macro using ‘\tikzstyle gridstyle =’ and how to apply that style to the what we are drawing.
 We can also see that our style definition is inheriting from the inbuilt style ‘help lines’. We are then what colour to use; this will overwrite the inherited colour.
 The ‘!40‘ in the colour: ‘blue!40‘ specifies the alpha or transparency to use.
Arcs and Angles:
Another thing that will be very useful to draw on our diagrams are arcs and angles (and indeed we will need these on our spherical trigonometry diagrams). Have a look at this example:
 \begin{tikzpicture}
 \draw[step=0.2, style=gridstyle] (1,1) grid (1,1);
 \draw (1.2,0) — (1.2,0);
 \draw (0,1.2) — (0,1.2);
 \draw (0,0) circle (0.8);
 \draw (0,1) arc (90:180:1);
 \draw (0.3,0) arc (0:30:0.3);
 p, li { whitespace: prewra
\draw (0,0) — (0.693,0.4);
 \end{tikzpicture}
This produces the following diagram:
 Here we have drawn two arcs. The arc starts from the specified (x,y) coordinate. Following the arc keyword, with then have a triple which is three numbers separated by columns. The first two numbers are angles and the third is the radius of the arc.
 In the first example we are drawing an arc starting from (0,1) and will be drawing the section that goes from 90deg to 180deg (the top left quadrant of a circle). We are also drawing with a radius of 1.
 The second arc starts from (0.3,0) and is specified from 0:30deg so it is also drawn clockwise. A smaller radius of 0.3 has been specified.
 As with a circle, to to draw an elliptical arc two radii should be specified.
 To calculate the end point of the radius I manually calculated x=r*cosθ, y = r*sinθ.
 \begin{tikzpicture}[scale = 2]
 \clip (0.1,0.1) rectangle (1,1);
 \draw[step=0.2, style=gridstyle1] (1,1) grid (1,1);
 \draw (1.2,0) — (1.2,0);
 \draw (0,1.2) — (0,1.2);
 \draw (0,0) circle (0.8);
 \fill[green!70!black] (0,0) — (3mm,0mm) arc (0:30:3mm) — (0,0);
 \end{tikzpicture}
This produces the following diagram:
 The first thing you might have noticed is that the figure has been scaled/enlarged and clipped/cropped.
 Scaling is quite straight forward, just include [scale = x] after opening the {tikzpicture} environment.
 Clipping is quite similar to \draw… but instead of using \draw we use \clip and the following shape/primitive will be used as a mask.
 We then have the filled/shaded shape. Similar to \clip, we have replaced \draw with \fill and then follow it with the shape to fill; in this case we have defined a closed path.
 The other new thing is how we have defined the fill colour. We now have ‘green!70!black‘ which means fill with the mixture of 70%green and 30%black. [This expression is possible since pgf uses Uwe Kern’s xcolorpackage]
 \begin{tikzpicture}[line width=5]
 \draw (0,0) — (1,0) — (1,1) — (0,0);
 \draw (2,0) — (3,0) — (3,1) — cycle;
 \useasboundingbox (0,1.3); % make bounding box higher
 \end{tikzpicture}
 We can see that the first closed path has not been drawn exactly how we might expect.
 The second closed path looks better. This is because we used the ‘cycle‘ keyword.
 Since the line width has been increased so much (to exaggerate the phenomenon) the bounding box needed to be adjusted so the text doesn’t run into the figure.
 \begin{tikzpicture}[scale = 2]
 \clip (0.1,0.1) rectangle (1,1);
 \draw[step=0.2, style=gridstyle1] (1,1) grid (1,1);
 \draw (1.2,0) — (1.2,0);
 \draw (0,1.2) — (0,1.2);
 \draw (0,0) circle (0.8);
 \filldraw[fill=green!20!white, draw=green!50!black]
 (0,0) — (3mm,0mm) arc (0:30:3mm) — cycle;
 \end{tikzpicture}
 Here a fill and draw colour has been defined. Hopefully you agree with me that it looks better.
p, li { whitespace: prewra
 \begin{tikzpicture}[scale = 2]
 \def\R{0.8} % circle radius

def\ANG{30} % the angle\clip (0.1,0.1) rectangle (1.2,1.2);
 \draw[step=0.2, style=gridstyle1] (1,1) grid (1,1);
 \draw (1.2,0) — (1.2,0);
 \draw (0,1.2) — (0,1.2);
 \draw (0,0) circle (\R);
 \filldraw[fill=green!20!white, draw=green!50!black]
 (0,0) — (0.3,0) arc (0:\ANG:0.3) — cycle;
 \draw[red,very thick] (\ANG:\R) — +(0,0.4);
 \end{tikzpicture}
 The first thing I have done to make our figure/diagram easier to manipulate is defined the radius of the circle and the angle we are displaying. This allows us to write more generic expressions and also makes our code/functions more reusable
 The next thing is how the start point of our line segment is defined. Instead of using (0.693, 0.4) a polar notation has been introduced where we specify an angle and radius: (Angle:Radius).
 The end of our line segment has also been defined differently. Instead of using absolute coordinates, we have used relative coordinates. This is done by placing a ‘+‘ in front of the coordinate. So in this case it means: from our last point go down 0.4 in y.
 \begin{tikzpicture}[scale = 2]
 \def\R{0.8} % circle radius
 \def\ANG{40} % the angle
 \clip (0.1,0.1) rectangle (1.2,1.2);
 \draw[step=0.2, style=gridstyle1] (1,1) grid (1,1);
 \draw (1.2,0) — (1.2,0);
 \draw (0,1.2) — (0,1.2);
 \draw (0,0) circle (\R);
 \filldraw[fill=green!20!white, draw=green!50!black]
 (0,0) — (0.3,0) arc (0:\ANG:0.3) — cycle;
 \draw[red,very thick] (\ANG:\R) — (\ANG:\R  0,0);
 \draw[blue,very thick] (\ANG:\R) +(0,0.514) — (0,0);
 \end{tikzpicture}
 The code is now quite flexible instead of specifying the relitive distance to move we have defined the second point in a new way using ““. The meaning of (m  n) is: the intersection of a vertical line through ‘m’ and a horizontal line through ‘n’.
 The other interesting thing to note is how the blue line segment’s start point is defined. We first define a point using the polar notation and the move relative to that point without drawing i.e we just move the pen. Of course, in this case it would be better to use “(\ANG:\R  0,0) — (0,0);” instead.
We now have the lines which represent sine and cosine, but what about the tangent line? It is hard to represent it with the methods employed so far, luckily there is yet another way:
 \begin{tikzpicture}[scale = 2]
 \def\R{0.8} % circle radius
 \def\ANG{40} % the angle
 \clip (0.1,0.1) rectangle (1.2,1.2);
 \draw[step=0.2, style=gridstyle1] (1,1) grid (1,1);
 \draw (1.2,0) — (1.2,0);
 \draw (0,1.2) — (0,1.2);
 \draw (0,0) circle (\R);
 \filldraw[fill=green!20!white, draw=green!50!black]
 (0,0) — (0.3,0) arc (0:\ANG:0.3) — cycle;
 \draw[red,very thick] (\ANG:\R) — (\ANG:\R  0,0);
 \draw[blue,very thick] (\ANG:\R  0,0) — (0,0);
 \draw[very thick,orange] (\R,0) — (intersection of {\R,0–\R,\R} and {0,0–\ANG:\R});
 \end{tikzpicture}
 Here we have found the second point by calculating the intersection of two lines (each of which are defined by two points)
 I found that the braces where necessary for the correct interpretation.
Ticks and Text:
While the figure is now taking shape our x and y axis are still a little lacking. Lets improve them by adding ticks and arrow heads:
 \begin{tikzpicture}[scale = 2]
 \def\R{0.8} % circle radius
 \def\ANG{40} % the angle
 \draw[step=0.2, style=gridstyle1] (1,1) grid (1,1);
 \draw [>] (1.2,0) — (1.2,0); \draw [>] (0,1.2) — (0,1.2);
 \draw (0,0) circle (\R);
 \filldraw[fill=green!20!white, draw=green!50!black]
 (0,0) — (0.3,0) arc (0:\ANG:0.3) — cycle;
 \foreach \x in {1,0.9, …, 1}{
 \draw (\x,0.05) — (\x,0.05);
 }
 \foreach \y in {1,0.9, …,1}{
 \draw (0.05,\y) — (0.05,\y);
 }
 \end{tikzpicture}
 The arrow heads for the x and y axis prove to be quite easy to add. Just include the [>] option before after the \draw. Arrows heads can also be added to arcs and can have a head on both sides by using [].
 To add ticks to our axis the ‘for‘ loop is introduced. This allows us to define a symbol (in this case \x), which we iterate over values given in the braces: {}. We could list the values separated by commas but in this case it is easier to specify it by {start, start+step…, end}. The statement(s) in the loop are then repeated for each \x.
 The yticks are produced in a similar way.
Now we might like to add text to our ticks. We can also do that:
 \begin{tikzpicture}[scale = 2]
 \clip (0.4,0.4) rectangle (1.2,1.2);
 \draw[step=0.2, style=gridstyle1] (1,1) grid (1,1);
 \draw [>] (1.2,0) — (1.2,0); \draw [>] (0,1.2) — (0,1.2);
 \foreach \i in {1,0.5, …, 1}{
 \draw (\i,0.05) — (\i,0.05);
 \draw (\i, 0) node[anchor=north]{$\i$};
 \draw (0.05,\i) — (0.05,\i);
 \draw (0, \i) node[anchor=east]{$\i$};
 }
 \end{tikzpicture}
 The keyword ‘node‘ tells TeX where we want to place our text. This is followed by some options and the what we want to display is placed in braces.
 The anchor option is like alignment, for example on the xaxis we want the north side of the node to be positioned at the specified coordinate. This may be somewhat counterintuitive so options like ‘above right‘ or ‘below‘ can be used instead.
 Note that we can have verbatim text inside the boxes/nodes.
 \begin{tikzpicture}[scale = 2]
 \draw[step=0.2, style=gridstyle1] (1,1) grid (1,1);
 \draw [>] (1.2,0) — (1.2,0); \draw [>] (0,1.2) — (0,1.2);
 \foreach \i in {1,0.5, …, 1}{
 \draw (\i,0.05) — (\i,0.05);
 \draw (0.05,\i) — (0.05,\i);
 }
 \foreach \i/\itext in {1, 0.5/\frac{1}{2}, 0.5/\frac{1}{2}, 1}{
 \draw (\i, 0) node[below] {$\itext$};
 \draw (0, \i) node[left] {$\itext$};
 }
 \end{tikzpicture}
 This time when we write our forloop we offer an alternate iterator (\itext), then where we use that alternate iterator inside the loop if an alternate definition is available it will use that instead. For example ‘0.5‘ has the alternate definition ‘\frac{1}{2}‘ so that will be used instead of ‘0.5‘ where \itext is used.
 This is obviously a very simple example.
 \begin{tikzpicture}[scale = 4]
 \def\R{0.8} % circle radius
 \def\ANG{40} % the angle
 \clip (0.3,0.3) rectangle (1.5,1.2);
 \draw[step=0.2, style=gridstyle2] (1,1) grid (1,1);
 \draw [>] (1.2,0) — (1.2,0); \draw [>] (0,1.2) — (0,1.2);
 \draw (0,0) circle (\R);
 \filldraw[fill=green!20!white, draw=green!50!black]
 (0,0) — (0.3,0) arc (0:\ANG:0.3) — cycle;
 \draw[red,very thick] (\ANG:\R) — node[left] {$\sin \alpha$} (\ANG:\R  0,0);
 \draw[blue,very thick] (\ANG:\R  0,0) — node[below, midway] {$\cos \alpha$} (0,0);
 \draw[very thick,orange] (\R,0) — node [right]
 {$\displaystyle \tan \alpha \color{black}=
 \frac{{\color{red}\sin \alpha}}{\color{blue}\cos \alpha}$}
 (intersection of {\R,0–\R,\R} and {0,0–\ANG:\R})
 coordinate (SAVE);
 \draw (0,0) — (SAVE) ;
 \foreach \i in {1,0.5, …, 1}{ % Draw the ticks
 \draw (\i,0.05) — (\i,0.05);
 \draw (0.05,\i) — (0.05,\i);
 }
 \foreach \i/\itext in {0, 0.5/\frac{1}{2}, 1}{ % add the yaxis labels
 \draw (0, \i) node[left] {$\itext$};
 }
 \foreach \x in {0, 1}{ % add the xaxis labels
 \draw (\x,0) node[below] {$\x$};
 }
 \end{tikzpicture}
 Lookin’ pretty good.
 But there is one new thing that can be taken away: the coordinated at the end of the tangent line was saved using “coordinate (SAVE)“. This coordinate was then reused to draw the black radius line.
The next post on TikZ/PGF will look at drawing 3D diagrams.
References:
 http://www.texample.net/tikz/examples/sphericalandcartesiangrids/
 http://www.texample.net/tikz/examples/mapprojections/
 http://www.tug.org/tugboat/tb301/tb94roegelspheres.pdf
 http://tex.stackexchange.com/questions/53445/howtodrawsphericalgeometrieswithtex
 http://tex.stackexchange.com/questions/46850/howcanidrawanarcfrompointabona3dsphereintikz/49589#49589
 http://melusine.eu.org/syracuse/pstricks/pstsolides3d/bonus/doc_trigo_spherique.pdf
 http://cahiers.gutenberg.eu.org/cgbin/article/CG_2007___48_7_0.pdf
 www.math.nus.edu.sg/aslaksen/projects/Wu%20ChengYuan.pdf
 http://www.bu.edu/math/files/2013/08/tikzpgfmanual.pdf
LaTeX Editors:
 TeXworks: https://www.tug.org/texworks/
 Kile: http://kile.sourceforge.net/
 LyX: http://www.lyx.org/
 TexMaker: http://www.xm1math.net/texmaker/
 writeLaTex: https://www.writelatex.com (online editor)
Ensure the following packages are installed:
$ sudo aptget install texlivefontsrecommended
$ sudo aptget install texlivefontsextra