I am drawing a grid on top of the layout defined with geometry.
\documentclass[letter]{article}
\usepackage{geometry}
\geometry{
showcrop,
paper = a4paper,
layout = a5paper,
layoutoffset={1cm,1cm}
}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}% just to generate text for the example
\makeatletter
% Code from:
% http://tex.stackexchange.com/questions/85064/grid-for-textpos-layout
\newcommand\rectangulargrid[2]{%
\tikz[
remember picture,
overlay,
yscale=-1,
xstep=\Gm@layoutwidth/#1,ystep=\Gm@layoutheight/#2,
xshift= -\Gm@layouthoffset, yshift=-\Gm@layoutvoffset,
]
\draw ($(current page.north west) - (\Gm@layouthoffset, \Gm@layoutvoffset)$) grid
($(current page.north west)+ (\Gm@layoutwidth, \Gm@layoutheight) + (\Gm@layoutwidth/#1, \Gm@layoutheight/#2) $);}
\makeatother
\begin{document}
\lipsum[1-3]
\rectangulargrid{16}{16}
\end{document}
I don't know why the grid lines are not aligned with the crop marks.
Any idea?