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.
[Tex/LaTex] Marking angles in a triangle
tikz-pgf
Related Solutions
To learn more about TikZ read pgfmanual.pdf. Via the macro \n
you can adjust the order of the root to be taken.
\documentclass[tikz]{standalone}
\usepackage{amsmath}% for \Re and \Im
\def\n{5}
\begin{document}
\begin{tikzpicture}[
dot/.style={draw,fill,circle,inner sep=1pt}
]
\draw[->] (-2,0) -- (2,0) node[below] {$\Re$};
\draw[->] (0,-2) -- (0,2) node[left] {$\Im$};
\draw[help lines] (0,0) circle (1);
\node[dot,label={below right:$O$}] (O) at (0,0) {};
\foreach \i in {1,...,\n} {
\node[dot,label={\i*360/\n-(\i==\n)*45:$w_{\i}$}] (w\i) at (\i*360/\n:1) {};
\draw[->] (O) -- (w\i);
}
\draw[->] (0:.3) arc (0:360/\n:.3);
\node at (360/\n/2:.5) {$\alpha$};
\end{tikzpicture}
\end{document}
For 1 < n < 13
:
[Tex/LaTex] Labeling sides and angles of a right triangle for an argument of the Pythagorean Theorem
Here's one possibility using "pure" TikZ:
The image was produced using simply
\begin{tikzpicture}
\RectTri{(0,3)}{(1,0)}{6cm}
\begin{scope}[xshift=8.5cm]
\RectTri[black]{(0,0)}{(4,2)}{4cm}
\end{scope}
\end{tikzpicture}
\RectTri
has three mandatory arguments; the first two are the coordinates for the vertices of one of the legs and the third one is the length of the second leg. The optional argument lets you customize the style used to draw the triangle.
The code:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,angles,quotes,decorations.markings}
\newcommand\RectTri[4][thick,green!50!black,text=black]{%
\coordinate [label=left:$C$] (C) at #2;
\coordinate [label=below right:$B$] (B) at #3;
\coordinate (aux) at ($ #2 ! 1 ! 90:#3 $);
\coordinate [label=above:$A$] (A) at ($ #2 !#4!(aux) $);
\coordinate (perp) at ($(A)!(C)!(B)$);
\draw[purple!70!black,thick,dashed] (C) -- (perp);
\draw[#1]
(C) --
node[auto] {$b$} (A) --
node[auto] {$c$} (B) --
node[auto] {$a$}
(C)
pic ["$\alpha$",draw,cyan,thick,angle radius=1cm] {angle = C--A--B}
pic ["$\alpha$",draw,cyan,thick,angle radius=1cm] {angle = B--C--perp}
pic ["$\beta$",draw,orange!70!black,thick,angle radius=1cm] {angle = A--B--C}
pic ["$\beta$",draw,orange!70!black,thick,angle radius=1cm] {angle = perp--C--A};
}
\begin{document}
\begin{tikzpicture}
\RectTri{(0,3)}{(1,0)}{6cm}
\begin{scope}[xshift=8.5cm]
\RectTri[black]{(0,0)}{(4,2)}{4cm}
\end{scope}
\end{tikzpicture}
\end{document}
And here's an approach using tkz-euclide
:
\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,1){A}
\tkzDefPoint(2,4){C}
\tkzDefPointWith[orthogonal normed,K=7](C,A)
\tkzGetPoint{B}
\tkzLabelPoint[left](A){$A$}
\tkzLabelPoint[right](B){$B$}
\tkzLabelPoint[above](C){$C$}
\tkzMarkRightAngle(A,C,B)
\tkzDrawSegment[green!60!black](A,C)
\tkzDrawSegment[green!60!black](C,B)
\tkzDrawSegment[green!60!black](B,A)
\tkzLabelSegment[auto](B,A){$c$}
\tkzLabelSegment[auto,swap](B,C){$a$}
\tkzLabelSegment[auto,swap](C,A){$b$}
\tkzDrawAltitude[dashed,color=magenta](A,B)(C)
\tkzGetPoint{D}
\tkzMarkAngle[size=1cm,color=cyan,mark=|](C,B,A)
\tkzMarkAngle[size=1cm,color=cyan,mark=|](A,C,D)
\tkzMarkAngle[size=0.75cm,color=orange,mark=||](D,C,B)
\tkzMarkAngle[size=0.75cm,color=orange,mark=||](B,A,C)
\end{tikzpicture}
\end{document}
Best Answer
Two simple possibilities using
TikZ
:For version 3.0, using the
angles
andquotes
libraries:The code:
For version 2.10, without libraries and using the
arc
path:The code: