Here's one possibility using "pure" TikZ:
![enter image description here](https://i.stack.imgur.com/YmQZa.png)
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}
![enter image description here](https://i.stack.imgur.com/SPF0f.png)
Your code produces errors; I tried to polish it by guessing what you were trying to do:
![enter image description here](https://i.stack.imgur.com/t0wEe.png)
The code:
\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}[dot/.style={fill,circle,inner sep=1.5pt}]
\path
(80:5) node [dot,label=above left:$A$]{} coordinate (A)
(80:7) coordinate (a)
(20:9) node [dot,label=below:$B$]{} coordinate (B)
(20:11) coordinate (b)
(0:0) node[dot,label=below left:$P$]{} coordinate(P)
(-100:1)coordinate (e)
(-160:1) coordinate (f);
\node[dot,label=below:$Q$] (Q) at ($(P)!(A)!(B)$) {};
\node[dot,label=above right:$R$] (R) at ($(P)!(Q)!(A)$) {};
\draw[<->] (a) -- (e);
\draw[<->] (b) -- (f);
\draw[purple!70!black,dashed] (A) -- (Q);
\draw[green!70!black,dashed] (Q) -- (R);
\tkzMarkRightAngle(A,Q,P);
\draw[|<->|] ($(P)!3mm!90:(A)$)--node[fill=white,sloped] {$r$} ($(A)!3mm!-90:(P)$);
\draw[|<->|] ($(P)!-7mm!90:(Q)$)--node[fill=white,sloped] {$x$} ($(Q)!-7mm!-90:(P)$);
\draw[|<->|] ($(Q)!-3mm!90:(A)$)--node[fill=white] {$y$} ($(A)!-3mm!-90:(Q)$);
\tkzMarkAngle[size=0.75cm,color=cyan,mark=||](B,P,A);
\tkzMarkAngle[size=1cm,color=cyan,mark=|](P,A,Q);
\end{tikzpicture}
\end{document}
Best Answer
I propose this solution with the
pst-eucl
module ofpstricks
, which can mimick constructions of plane geometry: