I have a problem with the header which I can't seem to solve. I am using the book class, and I want the part name and the chapter name in the header. I have tried using fancyhdr.
A MWE:
\documentclass[a4paper]{book}
\usepackage{fancyhdr}
\usepackage{emptypage}
\usepackage{lipsum}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[RO,LE]{\thepage}
\fancyhead[RE]{\rightmark}
\fancyhead[LO]{\leftmark}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\part{First part}
\chapter{First chapter}
\lipsum
\section{First section}
\lipsum
\part{Second part}
\chapter{Second chapter}
\lipsum
\section{Second section}
\lipsum
\backmatter
\end{document}
But instead of the section name on even pages I want the part name, i.e., instead of "First section" I want "First part".