I've been stuck here playing with numbers using \draw
for ages now. There must be a better way. I want to add this right-angle symbol:
and I don't know how I could do it neatly. Can someone help me out? Thanks. MWE:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[domain=0:4]
\draw (0.1,-0.2) node[left]{\textcolor{gray}{O}};
\draw[thick, color=gray,->] (-4,0) -- (8,0) node[right] {\textcolor{black}{$x$}};
\draw[thick, color=gray, ->] (0,-1) -- (0,5) node[above] {\textcolor{black}{$y$}};
\draw (3+2,5)--(-4+2,-1) node[above]{$l_1$};
\draw (-0.5,5)--(36/7-0.5,-1) node[above]{$l_2$};
\draw [color=gray, dashed] (1.9, 2.28) node[circle,fill=black,inner sep=0pt,minimum size=3pt, label=left:{\textcolor{black}{$P~~$}}]{}--(4.5,2.28)node[circle,fill=black,inner sep=0pt,minimum size=3pt, label=below right:{\textcolor{black}{$Q$}}]{}--(4.5,4.6) node[circle,fill=black,inner sep=0pt,minimum size=3pt, label= right: {\textcolor{black}{$~R$}}]{};
\draw (4.5,2.58)--(4.2,2.58)--(4.2,2.28);
\draw [color=gray, dashed] (1.9, 2.28) --(1.9,-0.3)node[circle,fill=black,inner sep=0pt,minimum size=3pt, label= below left:{\textcolor{black}{$S$}}]{}--(4,-0.3) node[circle,fill=black,inner sep=0pt,minimum size=3pt, label= below:{\textcolor{black}{$T~~~$}}]{};
\draw (1.9,0)--(2.2,0)--(2.2,-0.3);
\draw (2.9,2.28) arc (0:45:1cm);
\node at (2.5,2.5) {$\theta$};
\draw (3.4,2.28) arc (0:-51:1.5cm);
\node[rotate=-25] at (2.7,1.9) {$\theta-90^{\circ}$};
\draw (2.6,1.38) arc (-51:-93:1cm);
\node at (2.1,1.5) {$\theta$};
\end{tikzpicture}
\end{document}
Best Answer
With the latest PGF/TikZ, the Angle library supports Right Angle.
The following snippet is taken from the official manual (for 3.1.8b) on page 571 :