Document Classesfancyhdr question

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
geo_101
Posts: 7
Joined: Mon May 19, 2008 10:22 am

fancyhdr question

Post by geo_101 »

Hi guys.

I'm having some problems getting my headers to appeaper like I want them.
I want each page (except the title) to have a header with the chapter name and page number, and a footer with "DRAFT". For the most part I can do this... except for the first few parts.

My abstract, extended abstract and abbreviations have page numbers and a header line but no chapter names.
My TOC and LOF have the correct header, but not on the first page, here there is no header, just a footer with the page number in the centre.
The confusing thing is my list of tables... (only one page), has the correct header.
My main chapters are fine, but the problem reappears on the first page of the bibliography

Code: Select all

\documentclass[a4paper,12pt]{report}

\usepackage{fancyhdr}
\pagestyle{fancy}

\setlength{\headheight}{15pt}
\fancyhead[L]{\leftmark}
\fancyhead[R]{\thepage}
\fancyfoot[LCR]{DRAFT}
\renewcommand\headrulewidth{0.5pt}

\begin{document}
\doublespacing{}
\linenumbers
\title{``Thesis''}
\author{M. Y. Name}
\date{2008}
\maketitle{}

\pagenumbering{roman}

\begin{abstract}
\thispagestyle{fancy}
\addcontentsline{toc}{chapter}{Abstract}
Blah, blah, blah, blah.....
\end{abstract}

\include{extended_abstract}
\include{acknowledgements}
\include{abbreviations}

\tableofcontents
\thispagestyle{fancy}
\listoffigures
\addcontentsline{toc}{chapter}{List of Figures}
\thispagestyle{fancy}
\listoftables
\addcontentsline{toc}{chapter}{List of Tables}
\thispagestyle{fancy}

\pagenumbering{arabic}
\include{introduction}
\include{theory}
\include{results}
\include{conclusions}

\bibliographystyle{apalike}
\bibliography{Thesis_Refs}

\end{document}
Could this be related to a page numbering problem I also have. The numbers are:

i Abstract
i Extended abstract
ii Acknowledgements
iv Abbreviations
vii TOC
xi LOF
1 LOT
2 Intro

The first two pages should be consequtive and Intro should be page "1".
I've tried a few things, mostly different positions of "\thispagestyle{fancy}" and "\pagenumbering{}".
Bit of a long post, but any help would be appreciated.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

fancyhdr question

Post by Stefan Kottwitz »

Hi geo_101,
geo_101 wrote:My abstract, extended abstract and abbreviations have page numbers and a header line but no chapter names.
That's correct if you did not make them by \chapter. If you want their names appearing in the header although they are not chapters, you could use \markboth, for example:

Code: Select all

\markboth{\MakeUppercase{Abstract}}{}
geo_101 wrote:My TOC and LOF have the correct header, but not on the first page, here there is no header, just a footer with the page number in the centre.
The reason for this is that pagestyle plain is used for the first page of a chapter. Use

Code: Select all

\fancypagestyle{plain}{}
geo_101 wrote:My main chapters are fine, but the problem reappears on the first page of the bibliography
The bibliography ist not a real chapter, it's made using \chapter*. Here you can use \markboth too.
geo_101 wrote:Could this be related to a page numbering problem I also have.
At the moment I cannot see a real problem. Just use \pagenumbering and keep in mind, that the current page will be effected, so place \pagenumbering correctly. For other purposes you may use

Code: Select all

\setcounter{page}{number}
Stefan
LaTeX.org admin
geo_101
Posts: 7
Joined: Mon May 19, 2008 10:22 am

Re: fancyhdr question

Post by geo_101 »

Thanks for that I now have everything sorted.

Cheers :)
Post Reply