# Labeling a point at which a perpendicular is dropped

I saw the following code for drawing a triangle separated into two right triangles used in a demonstration of the Pythagorean Theorem. What does the code \tkzDefPointWith[orthogonal normed,K=7](C,A) instruct TikZ to typeset? How can I add "P" to the picture at the point that (dotted) line segment from C intersects line segment AB? I guess that I use the command \tkzLabelPoint. What is the optional argument to position P? After I label this point, I guess that I can have TikZ draw a right angle at this intersection with a command like \tkzMarkRightAngle(C,P,B).

\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{P}

\tkzMarkAngle[size=1cm,color=cyan,mark=|](C,B,A)
\tkzMarkAngle[size=1cm,color=cyan,mark=|](A,C,P)
\tkzMarkAngle[size=0.75cm,color=orange,mark=||](P,C,B)
\tkzMarkAngle[size=0.75cm,color=orange,mark=||](B,A,C)
\end{tikzpicture}

\end{document}


What does the code "\tkzDefPointWithorthogonal normed,K=7" instruct TikZ to typeset

Let us say, you have this command:

\tkzDefPointWith[orthogonal normed,K=7](C,A)


It instructs tikz to draw a perpendicaular to the line CA at C with the length of perpendicular line being K=7. From the manual, you have this code:

\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}

\begin{document}

\verb|\tkzDefPointWith[orthogonal normed,K=2](A,B)|

Here, $AB \perp AC$ and $K = 2$ means $AC = 2$

\begin{tikzpicture}[scale=1.2]
\tkzInit[ymin=1,xmax=5,ymax=5] \tkzGrid
\tkzDefPoint(2,3){A} \tkzDefPoint(4,2){B}
\tkzDefPointWith[orthogonal normed,K=2](A,B)
\tkzGetPoint{C}
\tkzDrawPoints[color=red](A,B,C)
\tkzLabelPoints[above right=3pt](A,B,C)
\end{tikzpicture}

\end{document}


How can I add "P" to the picture at the point that (dotted) line segment from C intersects line segment AB? I guess that I use the command "\tkzLabelPoint". What is the optional argument to position "P"?

Your guess is correct. You can give regular position specifier that you use with tikz like above, below, above right etc as the optional arguments. so this is a possibility:

\tkzLabelPoint[below](P){$P$}  %% This added to put the label P below


After I label this point, I guess that I can have TikZ draw a right angle at this intersection with a command like "\tkzMarkRightAngle(C,P,B)".

You guessed it right :-)

\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{P}
\tkzLabelPoint[below](P){$P$}  %% This added to put the label P below

\tkzMarkAngle[size=1cm,color=cyan,mark=|](C,B,A)
\tkzMarkAngle[size=1cm,color=cyan,mark=|](A,C,P)
\tkzMarkAngle[size=0.75cm,color=orange,mark=||](P,C,B)
\tkzMarkAngle[size=0.75cm,color=orange,mark=||](B,A,C)
\tkzMarkRightAngle(C,P,B) %% This added
\end{tikzpicture}

\end{document}


• I didn't see the command "\tkzDefPointWith[orthogonal normed,K=blah]" in any manual for TikZ. Is there a manual at a website that you can suggest to explain this command? What does "K" represent in this command? I see in the code that "\tkzDefPointWith[orthogonal normed,K=7](C,A)" precedes the command "\tkzGetPoint{B}". I am guessing that this code first plots points A and C, draws a line segment of length 7 from point C, and puts point B at the end. Why do you need "swap" in the command "\tkzLabelSegment[auto,swap](B,C){$a$}" for labeling the length of line segment BC? – user60254 Aug 8 '14 at 12:44
• @user60254 you need the manual for [tkz-euclide](hhtp://www.ctan.org/pkg/tkz-euclide) which is a nice package built upon PGF/TikZ. Follow the link I provided and you'll find the manual for the package (in French) under the section "Documentation". – Gonzalo Medina Aug 8 '14 at 13:32
• @user60254 See the manual of tkz-euclide. – mvkorpel Aug 8 '14 at 13:56
• @GonzaloMedina Is there any documentation available in English? (Or Welsh, just to prove I don't insist on English. Just English seems more likely. Statistically. A manual in Breton would not be too bad as I could probably figure that out. French is hopeless.) [That is, I am hopeless at French. I don't mean French is hopeless at anything.] – cfr Aug 22 '14 at 2:03
• @cfr Not that I know of. – Gonzalo Medina Aug 25 '14 at 19:50

Just for typing exercise with PSTricks.

\documentclass[pstricks,border=12pt,12pt,dvipsnames]{standalone}
\usepackage{pst-eucl}

\begin{document}
\begin{pspicture}[PointSymbol=none,RightAngleSize=.2,MarkAngle=90](9,5)
\pstGeonode[PosAngle={180,90,0},CurveType=polygon,linecolor=ForestGreen](1,1){A}(3,4){C}([offset=6]{A}C){B}
\pstProjection{A}{B}{C}[P]
\pstRightAngle{B}{C}{A}
\pstRightAngle{C}{P}{B}
\pcline(A)(B)_{$c$}
\pcline(C)(B)^{$a$}
\pcline(A)(C)^{$b$}