# fancyhdr style problem

I am having some problems with the fancyhdr package. How can I achieve the following in my big thesis file: The header should consists of the chapter name at the left side and the page number at the right side. The page with number 1 should be the first page of the first chapter. The "fancy" style should start after the table of contents and everything before should be enumerated with the letter i, ii and so on.

-
Are you using twoside? What document class are you using? – Werner Jun 1 '12 at 19:21
I am using \documentclass[leqno,12pt,a4paper,oneside]{book} – Nadori Jun 1 '12 at 19:24

In the following MWE I've created two different page styles: frontmatter and mainmatter. Your typical document structure will most likely include resetting the page style between these document components, including a call to \frontmatter/mainmatter to reset the page number and presentation (\roman and \arabic) as well as other ToC-related stuff:

\documentclass[leqno,12pt,a4paper,oneside]{book}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{fancyhdr}% http://ctan.org/pkg/fancyhdr
\fancypagestyle{frontmatter}{%
\renewcommand{\footrulewidth}{0pt}% No footer rule
\fancyfoot[C]{\thepage}%
}
\fancypagestyle{mainmatter}{%
\renewcommand{\footrulewidth}{.4pt}% Footer rule
}
\begin{document}
\frontmatter%
\pagestyle{frontmatter}% frontmatter page style
\tableofcontents
\chapter{Preface}
\lipsum[1-20]% Some dummy text

\mainmatter
\chapter{Introduction}%
\pagestyle{mainmatter}% mainmatter page style
\lipsum[1-20]% Some dummy text
\end{document}


You don't mention any hyperref-compatibility requirement. However, that could also be incorporated.

-
Why not using \frontmatter and \mainmatter instead of the \pagenumbering commands? You may include the page style choice in them. In this way you don't need \chapter* and \chapter{Preface} will not provide a number, but will make a TOC entry automatically. – egreg Jun 1 '12 at 19:52
@egreg: I've updated accordingly, thanks. – Werner Jun 2 '12 at 0:31
I have one small problem. The first chapter after the contents is the intruduction. I used \chapter*{Introduction}. How can I make sure this appears also in the list of contents (without a number). – Nadori Jun 3 '12 at 17:40
@Nadori: Use \chapter*{Introduction} \addcontentsline{toc}{chapter}{Introduction}. I would also suggest adding another page style (say, introduction) that provides clears Left header of \leftmark, otherwise you'll see "CHAPTER 0. Preface". With the other page styles created, it should be no problem to figure out what you want introduction to contain. – Werner Jun 4 '12 at 2:14