I am new to LaTeX and I am trying to place a rectangle (filled in red for instance) at the very top of all the pages of my document. The rectangle should be 0.5 cm high and with the page width.

I saw a lot of complicated threads to do that, but cannot manage to reproduce it.

My basic attempt by drawing a rectangle with \tikzpicture:



\fill[red] (0,0) rectangle (\paperwidth, 0.5cm)

The problem is that LaTeX only starts drawing at the top left corner of the margin and not of the page. I tried to use \voffset but nothing changes.


Welcome to TeX SX! You don't really need TikZ for that: a simple coloured \rule will do, and the eso-pic package will let you insert what you want at any position in the page:





enter image description here

  • Thanks Bernard, it works great ! Plus, I discovered new options. Note: I had to remove the option "showframe" in the geometry package. It crashed otherwise (maybe my distro does not support it). – user 9090909 Jan 23 '18 at 8:35
  • It's not your distribution, but probably you real code (or your real class) already loads geometry without this option, which is usually loaded for verification purpose, but isn't used in production. – Bernard Jan 23 '18 at 9:38

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.