0

I was given the following code on Stack Exchange for drawing a triangle with one vertex at the origin and with two angles drawn from the positive x-axis. I am using WinEdt to compile it. It is giving me error messages that are unfamiliar to me.

"<"C:\Program Files/My Own Download\MiKTeX 2.7\tex\latex\amsfonts\umsa.fd">"

Is there a package that I have to put in the preamble? I would also like to label the legs of the triangle a, b, and c and to give the coordinates of the vertices as P = (\cos\phi, \sin\phi) and Q = (\cos\theta, \sin\theta).

\documentclass{amsart}
\usepackage{}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{newlfont}
\usepackage{mathtools}
\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] {$\phi$};
\draw[->]
  (0.5,0) +(0:0.25cm) arc [radius=0.75cm,start angle=0,end angle=122] node[midway,above] {$\theta$};
\end{scope}
\end{tikzpicture}

\end{document}
2
  • There is one backslash/forward slash mismatch. Can it be the problem? Also your MikTeX is way too old. Upgrade to 2.9 if possible. Plus install it somewhere else and remove the empty \usepackage{} line.
    – percusse
    Jul 17, 2014 at 14:18
  • I downloaded the most recent version of MikTeX and had my computer compile the code. It gave me the same error message. Why is my computer going to the older version of MikTeX? I will ask someone in information technology about this.
    – user143462
    Jul 17, 2014 at 20:00

1 Answer 1

2

I am using MikTeX 2.9 with WinEdt. Your code compiles fine. I suggest you to update your distribution or at least update the amsmath package and related packages that generate the error. Regarding the second half of the question, here you go:

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{newlfont}
\usepackage{mathtools}
\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 (P) at (2,1);
\coordinate (Q) 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) -- node[pos=0.60,below] {$a$} (P) -- node[pos=0.45,above] {$b$} (Q) -- node[pos=0.60,left] {$c$} cycle;


% labelling the vertices
\node[mydot,label={right:$P = (\cos\phi, \sin\phi)$}] at (P) {};
\node[mydot,label={left:$Q = (\cos\theta, \sin\theta)$}] at (Q) {};
\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] {$\phi$};
\draw[->]
  (0.5,0) +(0:0.25cm) arc [radius=0.75cm,start angle=0,end angle=122] node[midway,above] {$\theta$};
\end{scope}
\end{tikzpicture}
\end{document}

The output looks like this:
enter image description here

1
  • This is exactly what I want! Thanks. My computer currently has MikTeX 2.7 and will not compile this code.
    – user143462
    Jul 17, 2014 at 20:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .