# how to add section number and name to the page header

I'm trying to modify the page layout of my thesis. I'd like to have at the top-right corner the section number and section title and at the top left corner the page number.

Using the following:

\usepackage{fancyhdr}

\begin{document}

\pagestyle{fancy}
\lfoot{}
\cfoot{}
\rfoot{}


I get what expected. However I'd like to add the section name. I've tried:

\pagestyle{fancy}
\lfoot{}
\cfoot{}
\rfoot{}


but of course it didn't work. I think it requires a bit more of programming but I only have a basic Latex tutorial so far where I can't find useful information. Thank you in advance for any advice

• Maybe what you want, roughly, is: \renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}} and then in \lhead{\rightmark}. But I think you have your description and code reversed. And is your thesis going to be 'one-sided'? – jon Nov 7 '13 at 16:24
• @jon Wanna write up an answer and get this off the list of unanswered questions? Thanks. – Johannes_B Jan 25 '15 at 17:00
• @Johannes_B -- No problem. – jon Jan 25 '15 at 17:35

(Based on an earlier comment.)

\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}

and then changing \lhead in the following way
\lhead{\rightmark}