0

I want to fill the area with different color within one page, and I find this question How to change the background color within a page.

After reading the answer of the above question, I think the format is this:

\fill[<the color I want to use>] ([xshift=<the offset in x dirction>,yshift=<the offset in y dirction>]<one vertex of diagnol of the rectangle>) rectangle ([xshift=<the offset in x dirction>,yshift=<the offset in y dirction>]<another vertex of the same diagnol of the rectangle>);

So I write the following code

\documentclass{article}
\usepackage{tikz}
\newcommand{\amount}{0.33\paperheight}  
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
  \fill[green] (current page.north west) rectangle ([yshift=-\amount]current page.north east);
  \fill[yellow] ([yshift=-\amount]current page.north west) rectangle ([yshift=-2\amount]current page.north east);
  \fill[red]([yshift=-2\amount]current page.north west) rectangle ([yshift=-3\amount]current page.north east);
\end{tikzpicture}
\end{document}

to fill the page with three colors. But I get the error 'Dimension too large.'

K.Robert
  • 421

1 Answers1

2