[Tex/LaTex] Force page style on all pages

footerpagestyletable of contents

In my document I want all my headers and footers to be the same, so I use this code for that purpose:

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancypagestyle{plain}
\fancyhf{}
\fancyhead[C]{}
\fancyfoot[C]{}
\fancyhead[RE,LO]{Manuel Alonso Cousido}
\fancyhead[LE,RO]{History}
\fancyfoot[RE,LO]{\thepage}
\fancyfoot[LE,RO]{\leftmark}

However, only some pages display the headers and footers. The first page of each chapter and the TOC pages have no header nor footer.

Do I have to use \thispagestyle{fancy} for every first page of chaper? In that case, how can I ensure that all the TOC pages get a footer and a header?

Best Answer

You can use pagestyle fancyplain instead fancy to get the same header and footer for plain and fancy pages. If there should be a headrule on plain pages too, redefine \plainheadrulewidth.

Example:

\documentclass{report}
\usepackage{fancyhdr}
\pagestyle{fancyplain}% <- pagestyle fancyplain
\renewcommand\plainheadrulewidth{.4pt}% headrule on plain pages
\fancyhf{}
\fancyhead[RE,LO]{Manuel Alonso Cousido}
\fancyhead[LE,RO]{History}
\fancyfoot[RE,LO]{\thepage}
\fancyfoot[LE,RO]{\leftmark}

\usepackage{blindtext}% only for dummy text
\begin{document}
\tableofcontents
\blinddocument
\end{document}

enter image description here

If there should be different entries for plain and fancy pages use \fancyplain.

Example:

\documentclass{report}
\usepackage{fancyhdr}
\pagestyle{fancyplain}% <- pagestyle fancyplain
\renewcommand\plainheadrulewidth{.4pt}% headrule on plain pages
\fancyhf{}
\fancyhead[RE,LO]{Manuel Alonso Cousido}
\fancyhead[LE,RO]{History}
\fancyfoot[RE,LO]{\thepage}
\fancyfoot[LE,RO]{\leftmark}

\fancyhead[C]{\fancyplain{plain page}{fancy page}}% <- added

\usepackage{blindtext}% only for dummy text
\begin{document}
\tableofcontents
\blinddocument
\end{document}

enter image description here

Related Question