TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I insert a rule in the header of all pages without the fancyhdr package? Is it necessary to use the fancyhdr package?

share|improve this question
Welcome to TeX.SE. It is always best to compose a fully compilable MWE that illustrates the problem so that the solution can be customized to your situation. Basically, show us that you have so far. – Peter Grill Feb 25 '12 at 21:39
"doesn't have the same length of the text": is this the only reason why you don't want to use fancyhdr? I don't see anything wrong with the length of the header rules when I use fancyhdr. – JohnJamesSmith Feb 25 '12 at 22:06
up vote 4 down vote accepted

Perhaps, in an attempt to diagnose the problem prematurely (and too long for a comment without visualization), here's a possible scenario causing the difference in length between the header rule and the text block: Choosing the page style before modifying the page layout dimensions.

In the minimal example below, the page style is set to fancy (from the fancyhdr package) before using geometry to set the page layout.

enter image description here

\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{fancyhdr}% http://ctan.org/pkg/fancyhdr
\usepackage{geometry}% http://ctan.org/pkg/geometry

Setting the page style to fancy after loading geometry yields

enter image description here

share|improve this answer
Great, that is the point! Thank you very much! – matt Feb 25 '12 at 22:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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