# Is there more compact way of simple point calculations?

I have this code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (2,2);

\draw[thick] (A) -- (B |- A);
\draw[thick] (B) -- (B |- A);

\draw ($(B |- A) - (.2,0)$) |- ($(B |- A) + (0,.2)$);
\end{tikzpicture}

\end{document}


which does that:

And simple question: can the last command be optimized? I am quite new to tikzpictures, maybe I don't know, how to get points like this ($(B |- A) - (.2,0)$) or right angle in a more compact way?

You do not even need calc. You can simply introduce an auxiliary coordinate, and use it.

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (2,2);

\draw[thick] (A) -| coordinate (aux) (B) ;
\draw ([xshift=-2mm]aux) |- ([yshift=2mm]aux);
\end{tikzpicture}

\end{document}


with tkz-euclide -- introduced some randomness in the point coordinates

\documentclass{article}
\usepackage{tkz-euclide}
\begin{document}

\begin{tikzpicture}[scale=1.0]
%define points A,B,C
\tkzDefPoint(0,0){C}
\tkzDefPoint(20:9){B}
\tkzDefPoint(80:5){A}
%label point A,B,C
\tkzLabelPoints(C)
\tkzLabelPoints[above](A)
%get line orthogonal to base CB
\tkzDefPointsBy[projection=onto B--C](A){a}
\tkzDrawSegment[dashed, red](A,a)
%marking right angles
\tkzMarkRightAngle(A,a,C)
%drawing dimension 10
\tkzDrawSegment[style=red, dashed, dim={$10$,15pt,midway,font=\scriptsize, rotate=90}](A,a)
\tkzDrawLine(a,C)
\tkzDrawPoints(A,C)
\end{tikzpicture}
\end{document}


You can load from tikz package the angles library which provides a command to draw right angle symbol but also arcs symbols for the others angles :

\usepackage{tikz}
\usetikzlibrary{calc,angles}
\begin{document}

\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (2,2);

\draw[thick] (A) -- (B |- A)node[coordinate](C){}--(B);

% \draw ($(B |- A) - (.2,0)$) |- ($(B |- A) + (0,.2)$); No !
\draw pic[draw,red,thick,angle radius =2mm]{right angle=B--C--A}; % Yes !
\end{tikzpicture}


You need to use nodes to reference the points you will use (that's why I've added node[coordinate](C){} to your code).