[Tex/LaTex] Customizing the header of the document

fancyhdrheader-footer

I am writing the thesis. I want to add page number in right side of page header and in left side of header i want to write the chapter name. I use the following commands but it does not work.

   \documentclass[letterpaper,12pt,titlepage,oneside,final]{article}
    \usepackage{fancyhdr}
    \fancyhead{}  % Clears all page headers and footers

    \pagestyle{fancy}
    \lhead{}
    \rhead{\thepage}
    \cfoot{center of the footer!}
    \renewcommand{\headrulewidth}{0.4pt}
    \renewcommand{\footrulewidth}{0.4pt}

\begin{document}   
     \lhead{\emph{chapter1}}
        \input{chapter1/introduction}
        \lhead{\emph{chapter1}}
        \input{chapter2/name}
        \lhead{\emph{chapter3}}
        \input{chapter3/name2}
        \lhead{\emph{chapter3}}
        \input{chapter4/name3}
     \end{document} 

Best Answer

If i understand the question correctly, the following is what you are looking for.

\documentclass[letterpaper,12pt,titlepage,oneside,final]{report}
\usepackage{fancyhdr}
\usepackage{blindtext}
\fancyhead{}  % Clears all page headers and footers

\setlength{\headheight}{15pt}
\pagestyle{fancy}
\fancyhead[r]{\thepage}
\fancyhead[l]{\fancyplain{\fancy}{\slshape\leftmark}}
\fancyfoot[c]{center of the footer!}
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyhead[r]{\thepage}
\fancyfoot[c]{center of the footer}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\renewcommand{\chaptermark}[1]{\markboth{\itshape\chaptername~\thechapter}{}}
\begin{document}   
\chapter{Wombat}
\blindtext[5]
\section{tabmow}
\blindtext[5]
\chapter{Capybara}
\blindtext[5]
\section{arabypac}
\blindtext[5]
\chapter*{Mara}
\markboth{Mara}{}
\blindtext[5]
\section{aram}
\blindtext[5]
\end{document}