[Tex/LaTex] Define coordinate based on other coordinate in Tikz

coordinatestikz-pgf

Can I define a coordinate relative to an already defined coordinate? If I define a coordinate (A) with

\coordinate (A) at (2,0);

Is there a way to define a coordinate (B) that is 2cm to the left and one 1cm to the top of (A)? I am looking for something like:

\coordinate (B) at (A+(2cm,1cm));

Thank you!

Best Answer

with calc library, you can add coordinates

\usetikzlibrary{calc} % in the preamble
...
\coordinate (B) at ($(A)+(2cm,1cm)$);

or with positioning library

\usetikzlibrary{positioning} % in the preamble
...
\coordinate[above right=1cm and 2cm of A] (B);