vendredi 28 novembre 2014

Drawing and labeling the sides and angles of a right triangle


The following code instructs TikZ to draw a right triangle AQP with a right angle at Q. I mark the length of line segment AQ by y. How do I rotate by 90 degrees the letter y so that it is upright? I would like to draw a line segment perpendicular to PA from A to the line containing the leg PQ, and I would like to label that point of intersection R.


Right before posting this on the web site, I did some editing of the code and now it is not compiling. I have tried to fix it.



\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}]

(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);
($(P)!(A)!(B)$) coordinate (Q);
\path
coordinate(a)
coordinate(b)
coordinate(P)
coordinate (e)
coordinate (f)
coordinate (A)
(20:9) coordinate (B)
($(P)!(A)!(B)$) coordinate [label=below:$Q$] (Q);

\draw[<->] (a) -- (e);
\draw[<->] (b) -- (f);

\draw[purple!70!black,dashed] (A) -- (Q);
\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,sloped] {$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}




Aucun commentaire:

Enregistrer un commentaire