[Tex/LaTex] Transforming coordinates, so (0,0) from tikzpicture is put in the desired place of the page


In tikz I can perform absolute positioning, e.g. (current page.center), but how I can specify/transform the coordinates, so (0,0) within tikzpicture will end in well-defined place like center of the page or at the location of the node used in previous tikzpicture?

It's possibly very simple to obtain, but I skimmed PGF manual and cannot find it there.

Best Answer

Use the shift={(<coordinate>)} TikZ key to shift the origin to this point. Use it either in the options for the tikzpicture or for an internal scope environment. As usual in such cases the tikzpicture should use remember picture,overlay.

% Relative to page center:
\begin{tikzpicture}[remember picture,overlay,shift={(current page.center)}]
    \draw (0,0) rectangle (1,1) node (SomeNode) {};
    \fill [red] (0,0) circle (5pt);
% Relative to node in previous picture:
\begin{tikzpicture}[remember picture,overlay,shift={(SomeNode.center)}]
    \draw (0,0) rectangle (1,1);
    \fill [green] (0,0) circle (5pt);