# Insert footer on chapter page but NOT header

this may or may not seem to be a weird thing to want, but I would like to have a customized header on all my pages, except the first one of each chapter, ToC, ..... Furthermore, I would like to have a footer in form of a simple line above the page number on each and every page, even on the first page of a chapter, ToC, ...

Well, me being new to LaTeX, I was thinking it could work if I insert the \fancypagestyle{plain} command after the header, so it might not apply for the header but for the footer. Well, that did not work.

Does anyone know how to do that? Is it even possible?

\documentclass[10pt,a4paper, twoside]{report}
\usepackage[latin1]{inputenc}
\usepackage{fancyhdr}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\pagestyle{fancy}

\begin{document}
\fancypagestyle{plain}{
\renewcommand{\footrulewidth}{0.4pt}}
\tableofcontents
\end{document}

• The starting page of chapter are plain, meaning an empty head (default). You can customize your headers and footers with the modern and flexible scrlayer-scrpage or fancyhdr. – Johannes_B Aug 21 '14 at 7:51
• Hey Johannes, thank you so much for your help. Actually I thought I was using the fancyhdr? Didn't I? In previous papers I simply needed a header on each page except the chapter page and I did that with \thispagestyle{fancy}. Now I need a footer, too. But in contrast to the header, I want it on all pages. – Nadine Aug 21 '14 at 8:01
• Yes you do, but i gave you an alternative as well. But right now, i am not quite sure, what you are trying to achieve. nor what the question is. But it is possible. – Johannes_B Aug 21 '14 at 8:02
• Okay, now I understand. Do you have a solution for how to achieve it with fancyhdr? I have never used scrlayer-scrpage before, but I will try to figure out how to use it! – Nadine Aug 21 '14 at 8:04
• We can get a solution, but i need to know what should be in the header an where. In your example above, you explicitely put stuff on plain pages. – Johannes_B Aug 21 '14 at 8:08

I am not entirely sure that I understand what you want but the code below:

• has a page footer on EVERY page with a line and the page number on the right-hand side

Rather than using fancyhdr etc I define the page headers and footers directly. When you type \pagestyle{mine} what happens is that latex executes the command \ps@mine, if it exists. The actual page headers and footers are stored in \@oddhead, \@evenhead, \@oddfoot and \@evenfoot so you just need to set these appropriately. There is also a \ps@empty command for clearing all of the current page headers and footers.

Anyway, this is what I have done:

\documentclass[10pt,a4paper,twoside]{report}
\usepackage{mwe}
\usepackage{tcolorbox}
\usepackage[foot=4em]{geometry}% need to make the footer bigger

\makeatletter
\def\my@foot{\hbox to \textwidth{\rlap{\rule[2ex]{\textwidth}{0.4pt}}\hfill\thepage}}
\def\ps@mine{\ps@empty% clear all current headings and footings
\let\@oddfoot\my@foot\let\@evenfoot\my@foot
}
\def\ps@plain{% this seems to be the "first" page for report.cls
\ps@empty\let\@oddfoot\my@foot\let\@evenfoot\my@foot
}
\makeatother
\pagestyle{mine}

\begin{document}
\tableofcontents
\section{A}\lipsum \section{B}\lipsum \section{C}\lipsum \section{D}\lipsum
\end{document}


Perhaps the most painful part of this game is working out which pagestyle controls the first pages of chapters etc. For report.cls this seems to be \ps@plain, so I have changed it in order to get your line in the footer on the "first" pages as well. (For amsart and friends I think it is \ps@firstpage...).

If this isn't quite what you want then please explain clearly what the problems are and I will try and fine-tune.

• I hope you saw the comment under my answer ;-) – Johannes_B Aug 21 '14 at 14:07
• @Johannes_B Ah, I think I misunderstood the nature of your challenge:) Having just looked at how your answer works I'm unsure why the OP didn't run with your first solution. I should also try and understand what this KOMA package does sometime...it looks interesting. – Andrew Aug 21 '14 at 14:15
• I would feel really sorry if your efforts were in vain. – Johannes_B Aug 21 '14 at 14:20
• Hey guys, again thank you so much for your time and helpful suggestions. @Andrew's version was just perfect, but for some reason it shattered my thesis into million pieces when applied it. But it is no big deal since I have a backup of my thesis. I decided to just leave it as it is know, meaning no header and footer on the chapter pages. I am way to unexperienced in latex to fix it and I gave you guys a headache and caused a lot of confusion as well. This was not my intention, so I am really sorry for that. – Nadine Aug 21 '14 at 15:26
• This answer is the handmade version, my answer (or rather comment) provides solutions used by many people. It should have worked out of the box. Please make sure you read some basic introductory material. It should cover this as well. Learning something new always requires to know the basics. – Johannes_B Aug 21 '14 at 17:49

Too long for a comment:

I still don't know, what you want in your headers. You used Contents, so i guess you want the \headmark. There is absolutely no reason to set this by hand.

An alternative to fancyhdr would be using the moden package scrlayer-scrpage. And why not use the corresponding KOMA class?

\documentclass[10pt,a4paper, twoside]{scrreprt}
\usepackage[automark,footsepline,plainfootsepline]{scrlayer-scrpage}
\usepackage{graphicx}
\cfoot[\pagemark]{\pagemark}
\usepackage{blindtext}
%\usepackage{showframe}
\begin{document}
\tableofcontents
\blinddocument
\blinddocument
\blinddocument
\blinddocument
\blinddocument
\blinddocument
\end{document}


The solution using fancyhdr.

\documentclass[10pt,a4paper, twoside]{report}
\usepackage{fancyhdr}
\usepackage[demo]{graphicx}
\pagestyle{fancy}
\fancypagestyle{plain}{%
\fancyhf{}%
\fancyfoot[C]{\thepage}%