To Display Current Section name as a header in Thesis Writing

Please guide me, what should i used instead of this code, so that the current section name will be displayed instead of the chapter name as a left side of the header in the page. Thank you.

• Welcome to TeX.SX! Instead of posting a screenshot of code it's better to show some of your code such that users can start immediately
– user31729
Sep 21 '15 at 16:39

You have to use \rightmark instead of \leftmark in your \rhead declaration. \rightmark contains the section info, while \leftmark is for the chapter:

\documentclass{book}

\usepackage{fancyhdr}

\fancyfoot{}

\pagestyle{fancy}

\begin{document}

\chapter{C1}

\section{S1}

\newpage
testpage 1
\newpage
testpage 2

\end{document}


Note that I used \fancyhead instead of \lhead and \rhead. It does the same, but you don't have to repeat everything.

• Please, remove \rm and change it into \normalfont. Note that \rm has been deprecated for 20 years. Also \sl should be \slshape. Sep 21 '15 at 17:31
• @egreg Done. I didn't think too much about the font style, just copied. \rm being deprecated is a good reason why I didn't know it :) Sep 21 '15 at 17:36