Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to use the fancyhdr package to format the headers for my dissertation, and I'm running into some problems.

For the introduction, I would like the even pages to have the page number and the word Introduction on the left-hand side, and for the odd pages, I would like to have the same thing (but the order transposed) on the right-hand side.

However, the remaining chapters have sections, so I would like to format them differently. I want the page number followed by Chapter name on the left-hand side of every even page, and the Section name followed by the page number on the right-hand side of every odd page.

This is a minimal example:

\documentclass[twoside]{report}
\usepackage{fancyhdr}
...
\fancyhead[LE]{\thepage\qquad Introduction}
\fancyhead[RO]{Introduction\qquad\thepage}
\fancyfoot[CE,CO]{}
\renewcommand{\footrulewidth}{0pt}
\renewcommand{\headrulewidth}{0pt}
\chapter{Introduction}
\pagestyle{fancy}
...
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}{}}
\fancyhead[LE]{\thepage\qquad\thechapter .~\leftmark}
\fancyhead[RO]{\thesection~\rightmark\qquad\thepage}
\fancyfoot[CE,CO]{}
\renewcommand{\footrulewidth}{0pt}
\renewcommand{\headrulewidth}{0pt}
\chapter{Background}
\pagestyle{fancy}
...

However, the last page of the Introduction has a header that corresponds to what the header for the next chapter should be.

Any suggestions would be appreciated...thanks!!

share|improve this question
1  
Can't test right now, but does a \cleardoublepage before the redefinition help? –  Caramdir Mar 12 '11 at 4:58
    
As a matter of fact, it does! However, it introduces a new problem: it adds an additional (blank) page to my introduction...with the correct header. –  Kristen Mar 12 '11 at 5:14

1 Answer 1

up vote 5 down vote accepted

The style is applied to the current page. So you need to clear the page first. This is done by \clearpage (end current page) or \cleardoublepage(clear current page and optionally add a blank page so that the next page with content is an odd page), depending on whether your chapters can start on any page or always start on an odd page.

share|improve this answer

Your Answer

 
discard

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.