[Tex/LaTex] Wrong header in Bibliography page

bibliographiesfancyhdr

I need help with header in bibliography page. I use fancyhdr to set different headers for even and odd pages. When my bibliography runs long to a second page, the header appears as like what I set earlier by fancy. I would like the header to be Bibliography instead of COMEDY.

I write in book class.

\documentclass[a4,11pt,twoside]{book}

\usepackage{csquotes}
\usepackage[utf8]{inputenc}
\usepackage{emptypage}
\usepackage[nottoc,notlot,notlof]{tocbibind}
\usepackage{url}
\usepackage{nth}
\usepackage{titlesec}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[LE]{\slshape COMEDY}
\fancyhead[RE]{}
\fancyhead[LO]{\hfill \slshape \leftmark}

\renewcommand{\headrulewidth}{0pt}


\title{My title}
\author{My name}
\date{}



\begin{document}

\pagenumbering{roman}

\maketitle
\tableofcontents 
\renewcommand{\headrulewidth}{.4pt}


\chapter*{Notes}
\addcontentsline{toc}{chapter}{\numberline{}Notes}

This book is made possible by the contributions of:



\chapter{example}


\begin{thebibliography}{99}

\bibitem{example}
\bibitem{example}
\bibitem{example}

\end{thebibliography}


\end{document}

Thank you!

Best Answer

We can just redefine the relevant headers before the bibliography. In this case,

\fancyhead[LE]{\slshape BIBLIOGRAPHY}

is enough. However, this will also affect the heading on the current page unless we insert \clearpage. This doesn't result in an extra page because the start of the bibliography begins a new page in any case. What it does is ensure that the current page is output with the current headings before the change is made to the header.

Somewhat simplified modified version of your MWE:

\documentclass[a4,11pt,twoside]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[LE]{\slshape COMEDY}
\fancyhead[RE]{}
\fancyhead[LO]{\hfill \slshape \leftmark}

\renewcommand{\headrulewidth}{0pt}

\usepackage{kantlipsum}

\title{My title}
\author{My name}
\date{}

\begin{document}

\renewcommand{\headrulewidth}{.4pt}

\chapter{example}

\kant[1-3]\clearpage

\fancyhead[LE]{\slshape BIBLIOGRAPHY}

\begin{thebibliography}{99}

\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}
\bibitem{example}

\end{thebibliography}

\end{document}

And the result:

Headings