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

I have a document with different page margins, so I have to change geometry settings after fancyhdr loaded. However, the width of header after geometry is not correct.

\usepackage[left=35mm, right=35mm]{geometry}
\fancyhead[C]{Some header text}

It's fine here.

\newgeometry{left=25mm, right=25mm}
PROBLEM: The line of header is 20mm narrower than expected here.

How can I solve this problem?

share|improve this question
You have to set the \geometry first, then \fancyhead. So in this instance, you have to reset the header. Have you tried that? Ideally, make a complete, minimal working example (MWE) that one can copy-and-paste to reproduce your problem. – Werner Dec 25 '12 at 5:04
@Werner Thanks for your advices, and I've added the MWE. Also, how to "reset" the header? – Haocheng Dec 25 '12 at 5:39
up vote 12 down vote accepted

Here's a MWE









The key here is the new command \resetHeadWidth which calls the fancyhdr macro for defining the header and footer widths.

share|improve this answer
It works, thank you. – Haocheng Dec 25 '12 at 6:02

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.