[Tex/LaTex] Handling header part in report class

double-sidedheader-footer

I have a small problem with the report class file. Actually I need that the odd pages have chapter title and page number in the header, while the even pages should have page number and chapter title.

Sample code like this:

\documentclass[onecolumn]{report}
\pagestyle{headings}
\begin{document}
\chapter{chapter title here}
\section{section title here}
blahblah
\end{document}

Best Answer

The fancyhdr package makes it easy to customise the headers and footers. For example

\documentclass[twoside]{report}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot{}{}{}
\fancyhead[LO,RE]{\leftmark}
\fancyhead[LE,RO]{\thepage}
\begin{document}
\chapter{A chapter}
\newpage
Even numbered page
\newpage
Odd numbered page
\end{document}

Note that the special pages on which chapters begin are not affected by this (though you can change them as well if you need to).

Related Question