[Tex/LaTex] How to use the layout and twoside options of the geometry package

double-sidedgeometrymarginspaper-size

When I use the geometry package (2010/09/12 v5.6) for a twoside document with one paper size (e.g. A4) and another layout size (e.g. A5), I had expected that I could print a page, turn the paper, print the other side, and cut the paper according to the crop marks. For this to work the crop marks at both sides of the sheet of paper must lay at the same position, i.e. if the first side is placed at the left of the sheet of paper,
the second one must be placed at the right side. But the MWE

\documentclass[twoside]{article}
\usepackage[twoside,a4paper,layout=a5paper,showframe,showcrop]{geometry}
\begin{document}
1
\newpage
2
\end{document}

and pdfLaTeX result into

pdfLaTeX MWE.tex

What must I change to get "twoside-mode"?

Best Answer

Looks to me like a bug in the code. The package switches to twoside within the calculations for the layout=a5paperbut neglects to move the whole area within the paper area as well (which it should in that case, I would say).

So I guess the answer is to do this manually:

\makeatletter
\newlength\hcorr
\setlength\hcorr{\paperwidth}
\addtolength\hcorr{-\Gm@layoutwidth}
\makeatother

\geometry{layouthoffset=.5\hcorr,
          layoutvoffset=1in}

The value of \Gm@layoutwidth is simply the internal width calculated by the layout= key or specified by layoutwidth=. The assumption is that \paperwidth minus that length divided by 2 puts our page smack in the middle horizonatally. And the layoutvhoffset=1inis just there to move the top cropmark onto the paper, you may not want that.