2

I am writing a thesis documentclass.

I get a line at the top, the chapter title and the even page number at the top of each page. I would like the page number to be at the bottom of the page, without deleting the chapter title from the header like it does with the fancypackage the way I found it here.

Is it possible?

\documentclass[12pt,a4paper, twoside, bold]{thesis}

%\usepackage{fancyhdr} 
%\fancyhf{}
%\cfoot{\thepage}
%\pagestyle{fancy}

\begin{document}

\tableofcontents

\chapter{Test}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec cursus egestas nisl, ac tristique lorem fermentum et. In interdum massa quis odio dictum, quis sagittis felis aliquet. In viverra diam massa, eget porta ante ullamcorper vitae. Curabitur non velit mattis, scelerisque neque ut, porttitor enim. Phasellus id ipsum ipsum. Duis nec nisi sem. Duis consequat, quam eu fermentum tempor, lacus sem commodo mi, eu aliquam risus nunc et nisl.
\end{document}

1 Answers1

2

Here is the entire setting using only fancyhdr. I have chosen the font shape and size of header and footer according to that of thesis class.

\documentclass[12pt,a4paper, twoside, bold]{thesis}
\setlength\headheight{15pt}
\usepackage{fancyhdr}
\fancyhf{}
\fancyhead[CE]{\small\slshape\leftmark}
\fancyhead[CO]{\small\slshape\rightmark}
\fancyfoot[CE,CO]{\small\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\pagestyle{fancy}

\begin{document}
\frontmatter
\tableofcontents
\chapter*{Preface}
\addcontentsline{toc}{chapter}{Preface}
\markboth{Preface}{}
Some preface
\mainmatter
\chapter{Test}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec cursus egestas nisl, ac tristique lorem fermentum et. In interdum massa quis odio dictum, quis sagittis felis aliquet. In viverra diam massa, eget porta ante ullamcorper vitae. Curabitur non velit mattis, scelerisque neque ut, porttitor enim. Phasellus id ipsum ipsum. Duis nec nisi sem. Duis consequat, quam eu fermentum tempor, lacus sem commodo mi, eu aliquam risus nunc et nisl.
\clearpage
Some text
\end{document}
  • It works, but I get contents twice, one flushed right and one flushed left, in the header – laureapresa Jan 19 '15 at 12:29
  • @rickratti See the updated answer. –  Jan 19 '15 at 13:21
  • This is what I wanted, thank you! There is one issue though. I added this to my main text. I get the toc, the next page shows "contents" and that's perfect. But the following page is \chapter*{Preface} with \addcontentsline{toc}{chapter}{Preface} so it appears in the toc without a number. But it is not considered in the header, and I still get "Contents". How do I get every chapter title to appear there? – laureapresa Jan 20 '15 at 08:27
  • 1
    @rickratti: Add \markboth{Preface}{} too. See the update. –  Jan 20 '15 at 12:15