[Tex/LaTex] Marking angles in a triangle

tikz-pgf

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.

Best Answer

Two simple possibilities using TikZ:

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

    enter image description here

    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:

    enter image description here

    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}