1

I know this is a very basic question but I somehow have not found an answer to this searching through the documentation (although I have to say it is probably my bad).

But how am I able to navigate from a given point in a tikz graphic? I am using tikz and tkz-euclide. And if I grab any point in space, how do I define another point to just be +1 in every direction away from that one? Like if I have my point A at (1/1) and I want A' to always be 1 away in x direction and two away in y direction, how do I do that?

If this helps:

\usepackage{tikz}
\usepackage{tkz-euclide}
\tkzDefPoint(1,1){A}
1

1 Answer 1

2

See Derived \coordinate in TikZ for various ways of defining relative coordinates with plain TikZ.

tkz-euclide has \tkzDefShiftPoint for this sort of thing, e.g. \tkzDefShiftPoint[B](1,2){A} to define B 1 unit lengths right and two units up relative to A.

\documentclass[border=4mm]{standalone}
\usepackage{tkz-euclide}

\usetikzlibrary{calc, positioning}
\begin{document}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (4,4);

\tkzDefPoint(1,1){A}
\tkzDefShiftPoint[A](1,2){B}
%\path (A) ++(1,2) coordinate (B);
%\coordinate (B) at ([shift={(1,2)}]A);
%\coordinate [above right=2 and 1 of A] (B); % requires positioning library
%\coordinate (B) at ($(A)+(1,2)$); % requires calc library

\draw [->] (A) -- (B);
\end{tikzpicture}
\end{document}
2
  • this is perfect. Thank you so much for this reply!
    – Tom Göbel
    Jun 19 at 20:20
  • @TomGöbel By the way, I think all those methods except the above right one lets you use polar coordinates with (<Angle>:<distance>) instead of xy-coords. If you need that. Jun 19 at 20:38

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.