I have a typical geometric construction that I want to draw using TikZ
. The following code gives a line segment PQ
. How do I get TikZ
to draw a point on the line perpendicular to PQ
and through P
that is 2\sqrt{2}
units below the line segment PQ
? I think that I have to have \usetikzlibrary{calc}
in the preamble to do this. (I want to label this point R and draw right triangle QPR
.) If I want to use \tkzMarkRightAngle(Q,P,R);
to indicate that the triangle is a right triangle, do I have to have \usepackage{tkz-euclide}
in the preamble?
\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning,intersections,quotes}
\begin{document}
\begin{tikzpicture}
\draw[yellow, line width=0.1pt] (-1.75,-1.75) grid[xstep=0.5, ystep=0.5] (2.75,1.75);
\draw[draw=gray!30,latex-latex] (0,1.75) +(0,0.25cm) node[above right] {$y$} -- (0,-1.75) -- +(0,-0.25cm);
\draw[draw=gray!30,latex-latex] (-1.75,0) +(-0.25cm,0) -- (2.75,0) -- +(0.25cm,0) node[below right] {$x$};
\node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]left:$P$}] (P) at (-1,-1) {};
\node[outer sep=0pt,circle, fill,inner sep=1.5pt, label={[fill=white]right:$Q$}] (Q) at (2,1) {};
\draw[green!20!white] (P) -- (Q);
\end{tikzpicture}
\end{document}
Best Answer
Check the code for explanatory comments: