As you you can see in the following image, a right angle has some space to side BC.
How can I fix it and is there any better way to add an right angle?
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[fill=gray!10] (0, 4) coordinate (A)
-- node[above=4pt] {$4cm$} (3,4) coordinate (C)
-- node[right] {$8cm$} (3,0) coordinate (B)
-- node[left] {$xcm$} (0, 4);
\draw (2.6,4) -- ++(0,-10pt) -- ++(10pt,0);
\node at (A)[anchor=east] {$A$};
\node at (B)[anchor=north] {$B$};
\node at (C)[anchor=south] {$C$};
\end{tikzpicture}
\end{document}
Best Answer
Since the little square has side
10pt
, you need to start10pt
to the left ofC
using, for exampleA complete example:
If you are going to do a lot of constructions like this one, I'd like to suggest you the
tkz-euclide
package; it has a very intuitive syntax and has a predefined command\tkzMarkRightAngle
to easily mark the right angles: