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 am using a fancy page style for my report. I am using the following code to set the width of the body:

\usepackage[left=3cm, right=2.5cm, top=2.65cm, bottom=2.65cm]{geometry}

However, the bar in the header is not taking the same width. I would like to know how to fix the width of the black bar in the header.

share|improve this question

closed as too localized by mafp, Werner, Kurt, Speravir, Thorsten Mar 28 '13 at 6:30

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

You should set \pagestyle{fancy} after the call to geometry. – egreg Mar 23 '13 at 19:00
Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say "thank you" to users who helped you. – Jubobs Mar 23 '13 at 19:00
Thank you! I have a second question: how to remove the left title on this header? (and keep the right title of the header) – mirabelle Mar 23 '13 at 19:06
It seems that is a follow-up question. Please ask another question on the main site. – mafp Mar 27 '13 at 23:24
up vote 1 down vote accepted

As noted in a comment, you should put your pagestyle changes after the loading of geometry. If you still need to enlarge the header and/or footer, you can look for \fancyhfoffset in the fancyhdr documentation.

Here is an example of it in action, taken from the LaTeX Wikibook page on Page Layout.

    % Note the ## here. It's required because \fancypagestyle is making a macro
    % (\ps@fancybook).  If we just wrote #1, TeX would think that it's the argument
    % to \ps@fancybook, but \ps@fancybook doesn't take any arguments, so TeX would
    % complain with an error message.
    % You are not expected to understand this.
    \renewcommand*{\sectionmark}[1]{ \markright{\thesection\ ##1} }%
    \renewcommand*{\chaptermark}[1]{ \markboth{\chaptername\ \thechapter: ##1}{} }%
    % Increase the length of the header such that the folios
    % (typography jargon for page numbers) move into the margin
    \fancyhfoffset[LE]{6mm}% slightly less than 0.25in
    % Put some space and a vertical par between the folio and the rest of the header
share|improve this answer
Thank you it works! I have a second question: how to remove the left title on this header? (and keep the right title of the header) – mirabelle Mar 23 '13 at 19:06
See the examples on the linked page. Modifying fancyhdr page styles via appropriate \.*mark and \mark.* macros is one of the trickier aspects of using it. – kahen Mar 23 '13 at 19:08
The simplest is of course just to use \fancyhead[LO]{}. That should make the left side of the header on verso (odd-numbered) pages empty. – kahen Mar 23 '13 at 19:14
Thank you, it is awesome! – mirabelle Mar 23 '13 at 19:17

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