2

I used color to color my page. I want a horizontal (halfway) colored patch which begins from the midpoint and ends at the right end of the page. (Only for the first page and not for the complete document.) I've used the following commands from the package.

\usepackage{color} \color{white} \pagecolor{black}

  • Just to be clear: Only one page coloured halfway from top to middle of the page? – Werner Mar 20 at 17:44
  • @Werner yes only one page but not from the top to middle, please see the edit. It should be from the mid of the page to the right end of the same. Thank you. – Niranjan Mar 20 at 17:49
3

The following example uses eso-pic to tap into the shipout mechanism, printing a rectangular block in BackGround of the current page. The hook is the LowerLeft part of the Page, so we shift over .5\paperwidth and then set a rectangle of appropriate size.

enter image description here

\documentclass{article}

\usepackage{eso-pic,xcolor}
\usepackage{lipsum}

\begin{document}

% To this page only, add a background that fills have the page (from the top)
\AddToShipoutPictureBG*{%
  \AtPageLowerLeft{%
    \hspace*{.5\paperwidth}%
    \color{blue}%
    \rule{.5\paperwidth}{\paperheight}%
  }%
}%

\lipsum[1-10]

\end{document}
  • Thank you so much. This worked for me. Just one problem. rmargin is creating a problem. It is still in the page color. I want my patch-page till the end of that page. – Niranjan Mar 20 at 18:13
  • 1
    @Niranjan: Not sure what you mean by rmargin. You can increase the horizontal width of the rectangle to something much larger than .5\paperwidth and just let it bleed off the page. For example, \rule{\paperwidth}{\paperheight}... – Werner Mar 20 at 18:26
  • Yes. Did it. It worked. Thank you so much. – Niranjan Mar 21 at 2:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.