Once in a while I have to create a layout given by several parameters, such as "left margin 3cm, logo 4 cm from the right margin, 2cm high" etc. Now I use geometry package an other helpers to create a layout, but I need to print out the result in order to check if everything is correct (well, I use Acrobat for that, but not everyone has access to it).

What I am thinking: is there a package to put graph paper with a 1cm grid (and millimeter ticks) in the background, so I could easily check if my layout is correct?

  • I'm just adding a tikz-pgf tag, because I'm sure someone (not me though) will very soon write down a solution using that package.
    – yo'
    Feb 13 '12 at 11:09
  • I haven't tried this. Can you use the wallpaper package with a graph paper as a background image? There are options in that package to make the background image fit the page.
    – Sony
    Feb 13 '12 at 11:16
  • @Sony Hehe, I am ignoring the 'tikz-pgf' label and couldn't see my own question after you have added the label. "Why is TeX.SX eating my question" I thought. :)
    – topskip
    Feb 13 '12 at 11:23
  • @tohecz oh, wrong addressee in my last comment.
    – topskip
    Feb 13 '12 at 11:46
  • Sorry for confusing you.
    – yo'
    Feb 13 '12 at 11:54

I think the »eso-pic« package provides any easy method to get what you want.



The grid is customizable in many ways. The package manual has more details.

enter image description here

  • Some body seems to have a major problem with this answer. Otherwise it wouldn't have been voted down. Feb 13 '12 at 21:39

A TikZ solution might look like this.

  \begin{tikzpicture}[remember picture, overlay]
    \draw[very thin, green!20,step=1mm,xshift=7.5mm,yshift=7.5mm] (current page.south west) grid (current page.north east);
    \draw[very thin, red!20,step=1cm,xshift=7.5mm,yshift=7.5mm] (current page.south west) grid (current page.north east);

I am not entirely sure why the shifting is necesarry, but it is if you want the grid to 'start' at the top left.

Edit: Here is a robust solution:

\begin{tikzpicture}[remember picture, overlay,shift={(current page.north west)}]
  \draw[very thin, blue!10,step=2mm]
  (current page.south west) grid (current page.north east);
  \draw[very thin, red!20,step=1cm]
  (current page.south west) grid (current page.north east);
  • The shift appears to be an artifact of the document class. For memoir, the xshift is 3.5mm and the yshift 8.0mm. But drawing a line between the SW and NE co-ordinates appears to be correct, relative to the page. ¿Go figure? Feb 13 '12 at 13:50
  • I think we can use \pgftransformcm{1}{0}{0}{1}{\pgfpoint{7.5mm}{7.5mm}} to shift the whole picture.
    – percusse
    Feb 13 '12 at 18:13
  • @percusse: Yeah, I can also apply the shift on the tikzpicture, no reason to use the coordinate transformation matrix. I was more wondering why this was necessary in the first place... If I do \draw (0,0) grid (3,3) there isn't an offset I need to compensate for, so why is there when using the current page node? Feb 13 '12 at 18:32
  • @Brent.Longborough: That looks fine in an article though. The rectangle is exactly the page in that case. It also works fine for memoir if you remove all of the trimming and margining commands, so... Feb 14 '12 at 13:09

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.