Position a TikZ background pattern which is oversize (to bleed off the edge of the paper)

Peter Flynn just a moment. 1 answers, 0 views
tikz-pgf positioning cropmarks bleed

Thanks to several helpful people in an earlier question ("Create a TikZ overlay with RH mirror of LH") I managed to get my pattern background where it was needed. Now circumstances have changed, and it is needed for the cover for documents of varying thickness (so the width will be, for example, 5mm greater than standard paper width). The background pattern need to bleed 3mm off the edge on all four sides, fo trimming.

The test below uses the code from the earlier question, with the \bgmaster pattern 3mm wider on all edges (see image). The page background is formed from the RH half of the image placed on the LH half of the page, and the same RH half of the image mirror-flipped and placed on the RH half of the page. I can't see how to move the patterns up and right so that they properly overlap the crop marks by 3mm.

\documentclass[10pt,oneside]{report}
% Draw-on cover for A4 booklet 5mm thick, so basically A3
% A3 + 5mm more width to allow for thickness of spine.
% 3mm oversize is needed  on all sides to allow for bleed.
% Printed on SRA3 which is 320mm × 450mm
\usepackage[landscape,papersize={297mm,425mm},
  left=30mm,right=25mm,top=20mm,bottom=5mm,
  nohead,nofoot]{geometry}
% left side is the back cover, right side is the front cover
\usepackage[cam,center,width=450mm,height=320mm,landscape]{crop}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
% Create a diagonal-shaded pattern 
\newsavebox{\bgmaster}
% Make height and width 6mm more than paper size
\newlength{\overwidth}
\setlength{\overwidth}{\paperwidth}
\addtolength{\overwidth}{6mm}
\newlength{\overheight}
\setlength{\overheight}{\paperheight}
\addtolength{\overheight}{6mm}
% Pattern taken from another document
\savebox{\bgmaster}{%
  \begin{minipage}{\overwidth}%
    \begin{tikzpicture}%
      \node [shading = axis,
        rectangle,
        left color=CornflowerBlue,
        right color=CornflowerBlue,
        middle color=Orchid,
        shading angle=45,
        minimum width=\overwidth,
        minimum height=\overheight]{};
    \end{tikzpicture}%
  \end{minipage}%
}
\parindent0pt
\parskip0pt
\pagestyle{empty}
\begin{document}
% Use the RH half of the shaded pattern for the LH side
\begin{tikzpicture}[overlay,remember picture]
  \clip (current page.south west)
   rectangle (current page.north east);
   \node at (current page.west) {\usebox{\bgmaster}};
\end{tikzpicture}
% Use the RH half but mirror-flipped for the RH side
\begin{tikzpicture}[overlay,remember picture]
  \clip (current page.south west)
        rectangle (current page.north east);
  \node at (current page.east)
      {\reflectbox{\rotatebox[origin=c]{180}%
        {\usebox{\bgmaster}}}};
\end{tikzpicture}%
\end{document}

This is largely because I don't grok the fullness of \clip in TikZ yet. It's unclear to me what it is clipping: (a) the undimensioned tikzpicture, (b) the box being included by the \node statement, (c) the current logical LaTeX page, or (d) the papersheet on which LaTeX will put the current page. And it appears that \clip doesn't actually clip in the normal sense of crop, but imposes some kind of path on something. Does anyone have a suggestion as to how I can push the patterns up and right?

Page image of test file above

1 Answers


John Kormylo 04/11/2017.

The clip rectangle limits the area painted by the image. It was originally intended just to split the image into two halves for odd and even pages, but in this case only the right half image is used (twice).

Using the calc tikzlibrary one can offset the corners of the clip rectangles by 3mm in x and/or y.

\documentclass[10pt,oneside]{report}
% Draw-on cover for A4 booklet 5mm thick, so basically A3
% A3 + 5mm more width to allow for thickness of spine.
% 3mm oversize is needed  on all sides to allow for bleed.
% Printed on SRA3 which is 320mm × 450mm
\usepackage[landscape,papersize={297mm,425mm},
  left=30mm,right=25mm,top=20mm,bottom=5mm,
  nohead,nofoot]{geometry}
% left side is the back cover, right side is the front cover
\usepackage[cam,center,width=450mm,height=320mm,landscape]{crop}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc}
% Create a diagonal-shaded pattern 
\newsavebox{\bgmaster}
% Make height and width 6mm more than paper size
\newlength{\overwidth}
\setlength{\overwidth}{\paperwidth}
\addtolength{\overwidth}{6mm}
\newlength{\overheight}
\setlength{\overheight}{\paperheight}
\addtolength{\overheight}{6mm}
% Pattern taken from another document
\savebox{\bgmaster}{%
    \begin{tikzpicture}%
      \node [shading = axis,
        rectangle,
        left color=CornflowerBlue,
        right color=CornflowerBlue,
        middle color=Orchid,
        shading angle=45,
        minimum width=\overwidth,
        minimum height=\overheight]{};
    \end{tikzpicture}%
}
\parindent0pt
\parskip0pt
\pagestyle{empty}
\begin{document}
% Use the RH half of the shaded pattern for the LH side
\begin{tikzpicture}[overlay,remember picture]
  \begin{scope}
    \clip ($(current page.south west)+(-3mm,-3mm)$) rectangle ($(current page.north)+(0pmm,3mm)$);
    \node at (current page.west) {\usebox{\bgmaster}};
  \end{scope}
  \begin{scope}
    \clip ($(current page.south)+(0mm,-3mm)$) rectangle ($(current page.north east)+(3mm,3mm)$);
    \node[xscale=-1] at (current page.east) {\usebox{\bgmaster}};
  \end{scope}
\end{tikzpicture}

\end{document}

demo


HighResolutionMusic.com - Download Hi-Res Songs

1 Martin Garrix

Yottabyte flac

Martin Garrix. 2018. Writer: Martin Garrix.
2 Alan Walker

Diamond Heart flac

Alan Walker. 2018. Writer: Alan Walker;Sophia Somajo;Mood Melodies;James Njie;Thomas Troelsen;Kristoffer Haugan;Edvard Normann;Anders Froen;Gunnar Greve;Yann Bargain;Victor Verpillat;Fredrik Borch Olsen.
3 Sia

I'm Still Here flac

Sia. 2018. Writer: Sia.
4 Blinders

Breach (Walk Alone) flac

Blinders. 2018. Writer: Dewain Whitmore;Ilsey Juber;Blinders;Martin Garrix.
5 Dyro

Latency flac

Dyro. 2018. Writer: Martin Garrix;Dyro.
6 Cardi B

Taki Taki flac

Cardi B. 2018. Writer: Bava;Juan Vasquez;Vicente Saavedra;Jordan Thorpe;DJ Snake;Ozuna;Cardi B;Selena Gomez.
7 Bradley Cooper

Shallow flac

Bradley Cooper. 2018. Writer: Andrew Wyatt;Anthony Rossomando;Mark Ronson;Lady Gaga.
8 Halsey

Without Me flac

Halsey. 2018. Writer: Halsey;Delacey;Louis Bell;Amy Allen;Justin Timberlake;Timbaland;Scott Storch.
9 Lady Gaga

I'll Never Love Again flac

Lady Gaga. 2018. Writer: Benjamin Rice;Lady Gaga.
10 Kelsea Ballerini

This Feeling flac

Kelsea Ballerini. 2018. Writer: Andrew Taggart;Alex Pall;Emily Warren.
11 Mako

Rise flac

Mako. 2018. Writer: Riot Music Team;Mako;Justin Tranter.
12 Dewain Whitmore

Burn Out flac

Dewain Whitmore. 2018. Writer: Dewain Whitmore;Ilsey Juber;Emilio Behr;Martijn Garritsen.
13 Bradley Cooper

Always Remember Us This Way flac

Bradley Cooper. 2018. Writer: Lady Gaga;Dave Cobb.
14 Little Mix

Woman Like Me flac

Little Mix. 2018. Writer: Nicki Minaj;Steve Mac;Ed Sheeran;Jess Glynne.
15 Charli XCX

1999 flac

Charli XCX. 2018. Writer: Charli XCX;Troye Sivan;Leland;Oscar Holter;Noonie Bao.
16 Rita Ora

Let You Love Me flac

Rita Ora. 2018. Writer: Rita Ora.
17 Diplo

Electricity flac

Diplo. 2018. Writer: Diplo;Mark Ronson;Picard Brothers;Wynter Gordon;Romy Madley Croft;Florence Welch.
18 Jonas Blue

Polaroid flac

Jonas Blue. 2018. Writer: Jonas Blue;Liam Payne;Lennon Stella.
19 Lady Gaga

Look What I Found flac

Lady Gaga. 2018. Writer: DJ White Shadow;Nick Monson;Mark Nilan Jr;Lady Gaga.
20 Avril Lavigne

Head Above Water flac

Avril Lavigne. 2018. Writer: Stephan Moccio;Travis Clark;Avril Lavigne.

Language

Popular Tags