6

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!

10

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);
  • 5
    or with a shift: \coordinate (B) at ([shift={(2cm,1cm)}]A); – Ignasi Jan 19 '17 at 8:14
  • 3
    or \path (A) ++(2cm,1cm) coordinate (B);. – Paul Gaborit Jan 19 '17 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.