I have a problem with fancyhdr
. My header shows on odd pages the chapter name, and on even pages the section name. However, I have a unnumbered chapter with no sections (the conclusions), and in that case the even page header shows the name of the last section from the previous chapter. This is an example of what I have
\documentclass[a4paper,11pt,twoside,openright]{report}
\usepackage{fancyhdr}
\usepackage{lipsum}
\fancypagestyle{mypagestyle}{
\fancyhf{}
\renewcommand{\headrulewidth}{0.5pt}
\fancyhead[EL]{\small \textsl{\nouppercase{\rightmark}}}
\fancyhead[OR]{\small \textsl{\nouppercase{\leftmark}}}
\fancyhead[OL,ER]{\small \textsl \thepage}
}
\pagestyle{mypagestyle}
\renewcommand{\chaptermark}[1]{ \markboth{#1}{} }
\renewcommand{\sectionmark}[1]{ \markright{#1}{} }
\begin{document}
\chapter{First chapter}
\section{First section}
\lipsum
\chapter*{Second chapter}
\lipsum
\chapter{Third chapter}
\lipsum
\end{document}
As you can see, this is a problem only with the unnumbered chapter, while for the numbered chapter with no sections nothing is shown instead of the section name.
What I would like to have in general would be the name of the chapter instead of the name of the section, when my chapter does not have sections. Any ideas?