Marking angles in a triangle

I would like to have TikZ draw a triangle on the Cartesian plane - a triangle with vertices at the origin O, A = (2,1), and B = (-3, 5). I would also like to have two angles drawn and labeled - one from the positive x-axis to OA and one from the positive x-axis to OB. I would like the angles to have arrows where they touch OA and OB. I would also like to keep "\documentclass{amsart}" in the preamble.

Two simple possibilities using TikZ:

1. For version 3.0, using the angles and quotes libraries: The code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{angles,quotes}

\tikzset{
mydot/.style={
fill,
circle,
inner sep=1.5pt
}
}

\begin{document}

\begin{tikzpicture}[>=latex]
% the coordinates of the vertices
\coordinate (O) at (0,0);
\coordinate (A) at (2,1);
\coordinate (B) at (-3,5);
\coordinate (E) at (2,0);

% the axis
\draw[help lines,->] (-3.5,0) -- (2.5,0);
\draw[help lines,->] (0,-0.5) -- (0,5.5);

% the edges of the triangle
\draw (O) -- (A) -- (B) -- cycle;

% labelling the vertices
\node[mydot,label={right:$A$}] at (A) {};
\node[mydot,label={left:$B$}] at (B) {};
\node[mydot,label={below:$O$}] at (O) {};

% the arcs for the angles
\path[gray]
pic["$\alpha$" shift={(23pt,3pt)},draw,->,angle radius=1.5cm] {angle = E--O--A}
pic["$\beta$" above=6pt,draw,->,angle radius=0.75cm] {angle = E--O--B};
\end{tikzpicture}

\end{document}

2. For version 2.10, without libraries and using the arc path: The code:

\documentclass{amsart}
\usepackage{tikz}

\tikzset{
mydot/.style={
fill,
circle,
inner sep=1.5pt
}
}

\begin{document}

\begin{tikzpicture}[>=latex]
% the coordinates of the vertices
\coordinate (O) at (0,0);
\coordinate (A) at (2,1);
\coordinate (B) at (-3,5);

% the axis
\draw[help lines,->] (-3.5,0) -- (2.5,0);
\draw[help lines,->] (0,-0.5) -- (0,5.5);

% the edges of the triangle
\draw (O) -- (A) -- (B) -- cycle;

% labelling the vertices
\node[mydot,label={right:$A$}] at (A) {};
\node[mydot,label={left:$B$}] at (B) {};
\node[mydot,label={below:$O$}] at (O) {};

% the arcs for the angles
\begin{scope}[gray]
\draw[->]
(1,0) +(0:0.5cm) arc [radius=1cm,start angle=0,end angle=41] node[midway,right] {$\alpha$};
\draw[->]
(0.5,0) +(0:0.25cm) arc [radius=0.75cm,start angle=0,end angle=122] node[midway,above] {$\beta$};
\end{scope}
\end{tikzpicture}

\end{document}

• we have angles lib for that now on version 3.00 ;) Jul 10 '14 at 17:35
• @percusse really useful library. I've updated my answer. Thanks again. Jul 10 '14 at 18:04
• @user143462 I don't see one question; I see five of them :) the mydot in the options of a node simply makes the node adopt the style that I previously defined for mydot (the node will be a filled circle of 3pt diameter). So, for example, \node[mydot,label={below:$O$}] at (O) {}; draws a small filled circle at the coordinate given by (O) (previusly defined to be at (0,0)) and places the label $O$ below the (O) coordinate. I'll continue in another comment (almost reached the word limit for this one). Jul 18 '14 at 1:59
• (1,0) +(0:0.5cm) doesn't draw anything; it is the arc path which will do the drawing; a coordinate specified with a colon, uses polar coordinates: (<angle>:<length>), so (0:0.5) means 0.5 units at 0 degrees. Now, (1,0) +(0:0.5) is roughly equivalent to "move to (1,0) and then, from this point move 0.5 units in the direction given by 0 degrees" (see page 38 of the PGF manual for version 3.0 for a detailed explanation of the + and ++ modifiers). (continued) Jul 18 '14 at 2:09
• @user143462 basically, (1,0) +(0:0.5) could be replaced by (1.5,0) I used the apparently more complex form just to have a better control over the drawing of the arc. Jul 18 '14 at 2:09