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.

3 Answers 3


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);


  • Thank you very much for your answer. I was looking exactly for something as simple as you provided. It's sad that I overlooked it in PGF manual, but it is possibly not the first and not the last such thing, so forgive me in advance! :)
    – przemoc
    Jun 24, 2011 at 18:49

More simple with help of Martin !


  \begin{tikzpicture}[remember picture, overlay,shift=(current page.center)]
  \draw (-2,-1) rectangle (3,5);
  \draw (0,0) circle(2pt);
    \draw[gray] (current page.north) -- (current page.south)  
  (current page.west) -- (current page.east);   

With the first idea :

  \begin{tikzpicture}[remember picture, overlay]
  \node[inner sep=0pt] at (current page.center)  
  {\tikz[overlay]\draw (-2,-1) rectangle (3,5);} ; % overlay is necessary (przemoc !!) 

  \draw[gray] (current page.north) -- (current page.south)  
  (current page.west) -- (current page.east);

enter image description here

  • 1
    I wouldn't use cascaded tikzpictures because you can't really place (0,0) in the inner picture at the center of the node (or actually the other way around). Your first example will always place the lower left corner at the page center, i.e. only works if this is (0,0). It doesn't work when material is drawn in the negative directions, i.e. (-1,-1) rectangle (3,5). You seem to try to adjust for this in your second example, but IMHO there is no (easy or even only moderate difficult) way to get the required offset from the inner to the outer picture. Jun 22, 2011 at 21:25
  • Yes I realized my mistake too late Jun 22, 2011 at 21:50
  • I liked your early attempt too (not fully working though), because it can be sometimes better to do other things. Unfortunately you've retreated being "fooled" (definitely unintentionally) by Martin's comment. So sorry, but this time no upvote, as your answer now is just like Martin's one. Side note: I'll also provide my own answer later in the spirit of what were you trying before.
    – przemoc
    Jun 24, 2011 at 18:56
  • @Altermundus You may check my answer now and see what you forgot in your early attempts to get desired effect without using manually calculated shift in the node. @Martin You may revise your opinion now. :)
    – przemoc
    Jun 24, 2011 at 20:08
  • I need to take more time to give an answer ! Jun 24, 2011 at 20:54

Just after I asked question here (so before I got any answers on TeX.SE) micket from #latex@irc.freenode.net (where I asked similar question, but only about centering (0,0)) said that I can just put tikzpicture within a node being in the center of the page. I must admit I overlooked this embedding feature of TikZ.

Simple as that, but apparently not as simple as it seems. After all early versions of Altermundus's answer were exploiting this technique, but with some quirk. This answer is to provide a way of embedding tikzpicture in a node of another tikzpicture without setting shift key.


\begin{tikzpicture}[remember picture,overlay,x=25mm,y=25mm]
        (current page.north) -- (current page.south)
        (current page.west)  -- (current page.east);
        (current page.center) circle (5pt);
    \node at (current page.center) {%
                (-1,-1) -- (0,1) -- (1,-1) -- (2,1);


Now you may ask why anyone would like to use such technique, which isn't as concise as tikzpicture's shift. I'll tell you, because this is why I ended using this technique.


Above technique gives you possibility of easily changing the point of inner tikzpicture which is being positioned (according to the node where it is put):

  • from tikpicture's (0,0)
  • to tikzpicture's center.

How? By removing overlay from inner tikzpicture options. Lack of it was the reason behind Altermundus' quirk with shift in the outer tikzpicture node. He was so close...



It's true that remark has nothing to do with original question, yet it was important in my case, thus I thought I should share it with you as a separate answer. Hope it will be useful for others.

  • Exact I only forgot overlayfor the second picture. Jun 24, 2011 at 20:48
  • 1
    Ah, but nesting tikzpictures soon leads to madness! It can be done, but there are subtle difficulties, particuarly with the overlay option. Apr 10, 2012 at 21:05

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.