# Image behind and beyond crop marks?

This is what I'm trying to do... Please note that the images that will be used in the final version are of slightly uneven size, so that should ideally be taken into account. I've been through the usual suspects and hope someone can help!

Normal pages should look like this:

Pages with a background image (and no text whatsoever) like this:

Close up, notice the crop marks:

I'm using memoir with showtrims (custom page size), here's an MWE in just in case...

\documentclass[book,openany,showtrims]{memoir}
%  Crop settings via  http://latex-my.blogspot.dk/2009/10/setting-page-size -and-margins.html

%% The stock paper size
\setstocksize{236mm}{161mm}

%% The 'real' page size
\settrimmedsize{230mm}{155mm}{*}

%% The stock paper will be trimmed 3mm from the
%% top edge and 3mm from the left edge
\settrims{3mm}{3mm}

%% Spine and trim page margins from main typeblock
\setlrmarginsandblock{20mm}{15mm}{*}

%% Top and bottom page margins from main typeblock
\setulmarginsandblock{20mm}{20mm}{*}

%% Header occupies height of a single line;
%% Bottom edge of footer is 7mm from bottom edge
%% of typeblock
\setheadfoot{\baselineskip}{7mm}

%% Bottom edge of header is 7mm from top edge of
%% typeblock
\setlength\headsep{7mm}

\checkandfixthelayout

\usepackage[utf8]{inputenc}
\usepackage[danish]{babel}
\begin{document}
Bla
\end{document}

-
It seems that this might be relevant, but the crop marks and the scaling is not as it should be in my case... –  Kristian Nordestgaard Jul 20 '13 at 20:08
Nothing to do with the question but do not forget to use the microtype package for improved typography. –  pluton Jul 20 '13 at 22:17
WHen you say "Pages with a background image (and no text whatsoever)", are those pages float only pages automatically produced by the floating mechanism or are those pages manually created? –  Gonzalo Medina Jul 20 '13 at 22:27
Dupe of tex.stackexchange.com/questions/46280/… in addition to all that you should set the trim and bleed pdf boxes. –  WillAdams Jul 21 '13 at 1:55
@GonzaloMedina - they're manually created! –  Kristian Nordestgaard Jul 21 '13 at 6:28

## 1 Answer

Here's a possible solution. The "behind" part of the question is addressed in SNIPLET C.5 (BACKGROUND IMAGE AND TRIMMARKS) of the memoir manual:

This sniplet comes from another problem described in CTT. If one use the eso-pic package to add a background image, this image ends up on top of the trim marks. To get it under the trim marks Rolf Niepraschk suggested the following trick

\RequirePackage{atbegshi}\AtBeginShipoutInit
\documentclass[...,showtrims]{memoir}
...
\usepackage{eso-pic}
...


The "beyond" part can be solved using TikZ and its current page node. I defined a command \AddBackground to be placed on those pages where the background should appear (according to a comment to the question, these pages are manually created).

The code:

\RequirePackage{atbegshi}
\AtBeginShipoutInit
\documentclass[book,openany,showtrims]{memoir}

\setstocksize{236mm}{161mm}
\settrimmedsize{230mm}{155mm}{*}
\settrims{3mm}{3mm}
\setlrmarginsandblock{20mm}{15mm}{*}
\setulmarginsandblock{20mm}{20mm}{*}
\setheadfoot{\baselineskip}{7mm}
\setlength\headsep{7mm}
\checkandfixthelayout

\usepackage{eso-pic}
\usepackage{tikz}
\usepackage{lipsum}

\definecolor{bgcolor}{RGB}{220,123,228}

\newcommand\AddBackground{%
\AddToShipoutPictureBG*{%
\AtPageCenter{%
\tikz[remember picture,overlay]
\fill[bgcolor]
([xshift=5pt,yshift=5pt]current page.south west)
rectangle
([xshift=12pt,yshift=12pt]current page.north east);}}%
}

\begin{document}

\lipsum[1-4]
\clearpage
\AddBackground%
\null\vfill
{\centering\Huge IMAGE\par}
\vfill
\clearpage
\lipsum[1-4]

\end{document}


A close-up showing the desired positioning of the background with respect to the crop marks:

Of course, the same principle can be applied with an included image:

\RequirePackage{atbegshi}
\AtBeginShipoutInit
\documentclass[book,openany,showtrims]{memoir}

\setstocksize{236mm}{161mm}
\settrimmedsize{230mm}{155mm}{*}
\settrims{3mm}{3mm}
\setlrmarginsandblock{20mm}{15mm}{*}
\setulmarginsandblock{20mm}{20mm}{*}
\setheadfoot{\baselineskip}{7mm}
\setlength\headsep{7mm}
\checkandfixthelayout

\usepackage{eso-pic}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{lipsum}

\begin{document}

\lipsum[1-4]
\clearpage
\null\AddToShipoutPictureBG*{%
\tikz[remember picture,overlay]
\node at ([xshift=8pt,yshift=8.5pt]current page.center)
{\includegraphics[width=\dimexpr\paperwidth+10pt\relax,height=\dimexpr\paperheight+10pt\relax]{example-image-a}};}
\clearpage
\lipsum[1-4]

\end{document}


And a close-up:

-
I knew I had written that down somewhere ;-) –  daleif Aug 12 '13 at 19:29
Thanks, this seems to work! –  Kristian Nordestgaard Aug 13 '13 at 20:02