Here's my shot at it without crop
, geometry
, or eso-pic
.
I'm assuming you need the color to bleed over the trim, and therefore need the background underneath the crop marks (that's what the first, mystical line does).
Note the use of memoir
dimensions. All you need to do to remove/add the trims is to update \setstocksize
and \settrims
\RequirePackage{atbegshi}\AtBeginShipoutInit
\documentclass[10pt,twoside,showtrims]{memoir}
\setstocksize{216mm}{154mm}
\settrimmedsize{210mm}{148mm}{*}
\settrims{3mm}{3mm}
\setulmarginsandblock{20mm}{22mm}{*}
\setlrmarginsandblock{20mm}{20mm}{*}
\checkandfixthelayout
\trimLmarks
\usepackage{xcolor}
\newcommand{\bgleft}{{\color{yellow}\rule{\stockwidth}{\stockheight}}}% Background for even pages
\newcommand{\bgright}{{\color{green}\rule{\stockwidth}{\stockheight}}}% Background for odd pages
\usepackage{picture}
\usepackage{ifthen}
\usepackage{lipsum}
\begin{document}
\AtBeginShipout{%
\AtBeginShipoutUpperLeft{%
\ifthenelse{\isodd{\thepage}}%
{\put(0,-\stockheight){\bgright}}%
{\put(0,-\stockheight){\bgleft}}%
}%
}
\lipsum[1-15]
\end{document}
Following Meho's comments, I went back to the drawing-board, and here's the result. I haven't parameterised the image size, the trimmed size, nor yet the 3mm difference, but I believe this solution works (is correct?, even), for any arbitrary stock size and trimming geometry that ends up at A5 after trimming.
I have halved the size of the coloured backgrounds to help in testing. Their north-east corners correspond to the center point of Meho's images.
Uncomment the lines shown and tinker with the values there -- the coloured boxes should not move relative to the page (and text).
Here it is, then:
\RequirePackage{atbegshi}\AtBeginShipoutInit
\documentclass[10pt,twoside,draft,showtrims,a5paper]{memoir}
\settypeoutlayoutunit{mm}
\usepackage{lipsum}
\usepackage{ifthen}
\usepackage{picture}
\usepackage{xcolor}
\settrimmedsize{210mm}{148mm}{*}
% Un-comment to play with stock size and trimming arrangements
% \setstocksize{256mm}{184mm}
% \settrims{10mm}{10mm}
\setulmarginsandblock{20mm}{22mm}{*}
\setlrmarginsandblock{20mm}{30mm}{*}
\checkandfixthelayout
\trimLmarks
\newcommand{\bgleft}{{\color{yellow!50}\rule{77mm}{108mm}}}% Background for even pages
\newcommand{\bgright}{{\color{green!50}\rule{77mm}{108mm}}}% Background for odd pages
\newlength{\yboth}
\newlength{\xrecto}
\newlength{\xverso}
\yboth=\dimexpr\trimtop+\paperheight+3mm
\xrecto=\dimexpr\stockwidth-\trimedge-\paperwidth-3mm
\xverso=\dimexpr\trimedge-3mm
\AtBeginShipout{%
\AtBeginShipoutUpperLeft{%
\ifthenelse{\isodd{\thepage}}%
{\put(\xrecto,-\yboth){\bgright}}%
{\put(\xverso,-\yboth){\bgleft}}%
}%
}
\begin{document}
\lipsum[1-15]
\end{document}
The manual of geometry v5.6 reads:
"The options specified for the area, in which the page dimensions are
calculated, are added: layout
, layoutsize
, layoutwidth
,
layoutheight
and so forth. These options would help to print the
specified layout to a different sized paper. For example, with
a4paper
and layout=a5paper
, the geometry package uses 'A5' layout
to calculate margins with the paper size still 'A4'."
For your thesis layout=b5paper
, of course. Using layouthoffset=((A4 paper width minus B5 paper width)/2)
"specifies the horizontal offset from the left edge of the paper", "layoutvoffset
specifies the vertical offset from the top edge of the paper": layoutvoffset=((A4 paper height - B5 paper height)/2)
.
\usepackage[a4paper,layout=b5paper,layouthoffset=17mm,layoutvoffset=23.5mm,%
showcrop]{geometry}% B5 at A4
respectively
\usepackage[b5paper,layout=b5paper]{geometry}% B5 at B5
should work. And use either geometry
or \areaset
but not both, because they both try to set the page layout and mixing them can cause unwanted results.
Best Answer
Looks to me like a bug in the code. The package switches to twoside within the calculations for the
layout=a5paper
but 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:
The value of
\Gm@layoutwidth
is simply the internal width calculated by thelayout=
key or specified bylayoutwidth=
. The assumption is that\paperwidth
minus that length divided by 2 puts our page smack in the middle horizonatally. And thelayoutvhoffset=1in
is just there to move the top cropmark onto the paper, you may not want that.