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

Language

Popular Tags