I want to set a certain color to the margin areas (which is the region outside the content box of \textwidth by \textheight but inside the paper of course :-) ).

How to change this from within the latex document as opposed to change the geometry.sty?

  • The entire margins or just part thereof?
    – Joseph Wright
    Dec 25, 2010 at 13:32
  • @Joseph, all pages on the document. Dec 25, 2010 at 13:34
  • @Joseph, More precisely, all margins (left,right,top, bottom) for all pages on the document. Margin areas = Paper area minus content area. Dec 25, 2010 at 14:40
  • you have to redefine the two/three rule commands from geometry.
    – user2478
    Dec 25, 2010 at 17:38

3 Answers 3


And here an example without pstricks:

  • Thanks, worked for me. To include the footer area, do \rule{\textwidth}{\textheight}. Apr 12, 2014 at 21:32
  • This exactly answers the question, thank you. May 16, 2020 at 14:54

In ConTeXt, this can be done using


The first line sets the background color of the entire page to red, and the second line sets the background color of the text area to white.


Here is a variant with pstricks and eso-pic packages:


% ...




It would be better to ask TeX for exact margins (in example above i took exact margins i've provided to geometry package).

On the other hand --- it's possible to make shaded area smaller or like that. Round corner, let's say .-)

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.