1

I'm using the fancyhdr package to customize the header of my thesis. I want to have Chapter + chapter number on the left of the page and section name on the left of each page. I'm using the following command, but it didn't quite work

\usepackage{fancyhdr}
\fancyhf{}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter\ #1}{}}
\fancyhead[LE]{\bfseries\nouppercase{\leftmark}} 
\fancyhead[RO]{\nouppercase{\rightmark}\chaptermark}

The document class I'm using is report.

Could anyone help me to achieve what I want?

1
\documentclass{report}

\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{nameref}
\makeatletter
\newcommand*{\currentname}{\@currentlabelname}
\makeatother

\pagestyle{fancy}
\lhead{Chapter \thechapter}
\rhead{\currentname}

\begin{document}
    \chapter{Foo}

    \section{Bar}

    \lipsum
    \lipsum
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.