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?

2

1 Answer 1

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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .