Consider the following:

Let's say I have a dot. I would like to be able to position this dot anywhere on the page: at the corner, in the middle, anywhere.

So far, despite poring over manuals and experimenting, I can not figure out how to do this. It seems logical that there would be some system that would place a conceptual grid on the page and then allow for an exact placement within that grid.

I'm sure it exists, but I can't seem to find it.

I can make the dot, and all sorts of other shapes, but I just don't seem to have any control over where these shapes appear on the page.

I'm sure this is an obvious question and I have overlooked something.


Yes, it really does exist and is quite easy to use.

There are quite some subtleties in this as it can be cumbersome to use in several packages. The reason is that the compilation of the document has to be done several times in order to get the correct placement on the screen.

For instance, an A4-paper is not the size of an A3-paper, secondly you can not know the exact page size due to various packages in the making of the document.

One of the packages that is very nice to use this feature in is the beamer package. If you need this method in that package you are required to add fragile to the frame (ensures that the compilation will not fail with dubious error messages).

First of all you need to apply the remember picture to the tikzpicture environment. This enables tikz to save the picture size and various segments in the picture. Secondly you need to specify the overlay option which puts the picture out of the text-segment, allowing it to be placed on top of text without taking up any space. If you do not specify overlay it will be a regular text-box which is placed next to the preceding TeX-box. This is often not desirable when positioning relatively on the page. (Try and remove overlay from the example below and see the picture going out of bounds)

Now, in order to access the page you need the current page node which is referring to the rectangular shape that takes up the entire page. Thus you can refer to anchors and whatever you need via this.

Here is an example which gives you an idea...

\begin{tikzpicture}[remember picture,overlay]
  \foreach \bound in {north,south,west,east,45} {
      \node[anchor=\bound] at (current page.\bound) {I am \bound-bound...};
  \node at (current page.center) {I am NOT MOOVING!};
  % You can see the border of the page node with this:
  \draw[thick] (current page.south west) rectangle (current page.north east);

And the result is: enter image description here

Relative coordinate system

I wished to elaborate on this and also help those who wants the actual relative coordinate system of the page. You can also do this by other means, but for easy reference and clear cut code a coordinate system transformation is very easy to understand.

So basically what I have done is creating a page cs transformation which transfers the page into a grid as shown in the below code (describing the cs by (-1,-1) rectangle (1,1)).

For this you need the \tikzdeclarecoordinatesystem in order to redefine a cs. You can check out this in the manual if in doubt of how it is used.

% Defining a new coordinate system for the page:
% --------------------------
% |(-1,1)    (0,1)    (1,1)|
% |                        |
% |(-1,0)    (0,0)    (1,0)|
% |                        |
% |(-1,-1)   (0,-1)  (1,-1)|
% --------------------------
    \pgfpointanchor{current page}{north east}
    % Save the upper right corner
    % save the lower left corner
    \pgfpointanchor{current page}{south west}
    % Transform to the correct placement
    \expandafter\pgf@x\expandafter=\pgfmathresult pt
    \expandafter\pgf@y\expandafter=\pgfmathresult pt

This will allow you to do the following:

\begin{tikzpicture}[remember picture,overlay,every node/.style={anchor=center}]
  \node at (page cs:0.5,0.3) {0.5,0.3};
  \node at (page cs:-0.25,0.3) {-0.25,0.3};
  \node at (page cs:0,0) {0,0};
  \draw(page cs:-0.25,0) -- (page cs:.75,-0.5);
  \draw[thick] (page cs:-1,-1) rectangle (page cs:1,1);

which results in: enter image description here

  • How can I not position something relative to current page.east but shift it down by some amount? – white_gecko Sep 2 '16 at 14:32
  • I am not sure I understand your query? You can still use the calc library for moving below east? I.e. \draw (current page.east) -- ($(current page.east)+(0, -1)$);? – zeroth Sep 2 '16 at 14:33
  • Hm, I'm not to familiar with using libraries in tikz, but now I've just added transform canvas={yshift = -.5cm} as option for the \node[…], which moves the node down by .5cm. – white_gecko Sep 2 '16 at 14:39
  • I would only suggest that if you want the entire canvas moved? Else I think you should look up the calc library which is really handy in almost all tikz drawings. – zeroth Sep 2 '16 at 15:02

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.