0

I have a right triangle APR, with the right angle at A. Why is the right angle mark not at A? Why are several of the angle marks not centered about a vertex of the triangle? I draw an altitude of the triangle from A. I want to mark the length as h, for height, but I don't want the lines above and below h. How do I get that. Why do I have "h" printed near P?!

\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}


\begin{document}


\begin{tikzpicture}[dot/.style={fill,circle,inner sep=1.5pt},line width=.7pt]
\path
  (80:5) node[dot,label=above left:$A$]{} coordinate (A)
  (80:7) coordinate (a)
  (20:9) 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)$)node[dot,label=below:$Q$]{} coordinate(Q);

\path[name path=kline](f)--(b); % First line for intersection
\path[name path=ARline](A)--($(A)!10cm!90:(P)$); % A line normal to pA at point A in the east direction

\path [name intersections={of = ARline and kline, by=R}];
\draw (A)--(P)--(R)node[dot,label=below:$R$]{}--cycle;
\draw[purple!70!black,dashed] (A)--(Q);

\tkzMarkRightAngle(A,Q,P);
\draw[|<->|] ($(P)!-7mm!90:(Q)$)--node[fill=white,sloped]{$x$} ($(Q)!-7mm!-90:(P)$);
\draw[<->|] ($(Q)!-7mm!90:(R)$)--node[fill=white,sloped]{$y$} ($(R)!-7mm!-90:(Q)$);
\draw ($(Q)!-3mm!90:(A)$)--node[fill=white] {$h$} ($(A)!-3mm!-90:(Q)$);

\tkzMarkAngle[size=1cm,color=cyan,mark=|](P,A,Q);
\tkzMarkAngle[size=1cm,color=cyan,mark=|](A,R,P);
\tkzMarkAngle[size=0.75cm,color=cyan,mark=||](B,P,A);
\tkzMarkAngle[size=0.75cm,color=cyan,mark=||](Q,A,R);

\tkzMarkRightAngle(R,A,P);
\end{tikzpicture}


\end{document}

output

  • 1
    I am not able to reproduce your angle remarks. As per the picture too they look proper. For h remark without line, \path ($(Q)!-3mm!90:(A)$)--node[fill=white,sloped] {$h$} ($(A)!-3mm!-90:(Q)$); (you may prefer not to have sloped though). Note \draw\path. – user11232 Dec 6 '14 at 15:06
  • ++@HarishKumar, you can use: \node at ($(A)!0.5!(Q)$) [fill=white] {$h$}; – ferahfeza Dec 6 '14 at 15:12
  • @ferahfeza What is the syntax \node at ($(A)!0.5!(Q)$) {$h$}; instructing TikZ to draw? – Adelyn Dec 6 '14 at 15:53
  • @Harish Kumar In the code, I have the following command. ($(P)!(A)!(B)$)node[dot,label=below:$Q$]{} coordinate(Q); Please explain the syntax to me. Why do we need a pair of dollar signs? What does the exclamation point after the "P" and after the "A" instruct TikZ to draw? – Adelyn Dec 6 '14 at 16:05
  • @Harish Kumar Do you know the length of each side of the right angle mark in this drawing? I have a diagram of right triangles that are drawn using tkz-euclide on another page; I want the right-angle marks that I have to manually make in this diagram to be identical to the right angle marks drawn by TikZ. – Adelyn Dec 6 '14 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.