0

The design of a two-page spread for chapter openings involves a shaded background which runs across both pages. I have constructed this with:

\documentclass{article}
\usepackage[a3paper,landscape,margin=0pt,nohead,nofoot]{geometry}
\pagestyle{empty}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
  \node [shading = axis,
    rectangle,
    left color=Red,
    right color=Red,
    middle color=Blue,
    shading angle=45,
    anchor=north,
    minimum width=\paperwidth,
    minimum height=\paperheight] (box) at (current page.north){};
\end{tikzpicture}
\end{document}

I need to use this in two halves, one for the left-hand page and one for the right-hand page (both will get other material superimposed).

Example 2-page shading done as overlay

Can I use this overlay twice, once for the left-hand half and once for the right? Perhaps by clipping or viewporting differently for each one? I can't see from the TikZ manual anything to do that (clip seems to do something completely different).

Or is there a way to construct two separate overlays which will join up to resemble thw full double-page spread? (My trig isn't good enough to work that out).

Peter Flynn
  • 2,870

1 Answers1

1

Are you just going to do this once, or every odd/even page?

\documentclass{article}
\usepackage[a4paper]{geometry}
\pagestyle{empty}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}

\newsavebox{\master}

\savebox{\master}{\begin{minipage}{2\paperwidth}
  \begin{tikzpicture}
    \node [shading = axis,
      rectangle,
      left color=Red,
      right color=Red,
      middle color=Blue,
      shading angle=45,
      minimum width=\textwidth,
      minimum height=\paperheight]{};
  \end{tikzpicture}%
\end{minipage}}

\begin{document}
\begin{tikzpicture}[overlay,remember picture]
  \clip (current page.south west) rectangle (current page.north east);% not needed
  \node[inner sep=0pt, outer sep=0pt] at (current page.east) {\usebox{\master}};
\end{tikzpicture}

\null\newpage
\begin{tikzpicture}[overlay,remember picture]
  \clip (current page.south west) rectangle (current page.north east);% not needed
  \node[inner sep=0pt, outer sep=0pt] at (current page.west) {\usebox{\master}};
\end{tikzpicture}

\end{document}
John Kormylo
  • 79,712
  • 3
  • 50
  • 120
  • Only 2–3 times per document: it's for chapter-starts. Thank you (and sorry for the delay; I was indisposed)...but that code puts the background image mostly off-paper, in the top right-hand corner. How do I make it cover the whole page? – Peter Flynn Jan 14 '17 at 23:34
  • Did you run it twice? (The origin location is stored on the aux file.) – John Kormylo Jan 15 '17 at 20:11
  • Duuh. Sorry, yes, of course. Thanks very much. – Peter Flynn Jan 15 '17 at 20:30
  • Thank you for your help; I got this to work inside my document OK. I've posted another related one, though, which I can't figure out (353479 :-) – Peter Flynn Feb 12 '17 at 16:11