Customizing the header of the document

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}

\pagestyle{fancy}
\cfoot{center of the footer!}
\renewcommand{\footrulewidth}{0.4pt}

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

• your question is unrelated to texstudio or ubuntu (tex works the same way whichever editor you use to write the source file) so I have removed the tags (but left the title) – David Carlisle Jul 14 '17 at 19:52
• it is hard to answer your question as there are many "thesis" styles and you give no indication of yours so no one can run your example (which also inputs files we do not have) but all the \lhead within the document should be removed, the \chapter will be setting a mark to put the chapter name in the head automatically. – David Carlisle Jul 14 '17 at 19:55
• Using lhead so often is rubbish, your \chapter calls should update the header. On the other hand, article does not provide chapters. – Johannes_B Aug 12 '17 at 10:12

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}

\pagestyle{fancy}
\fancyfoot[c]{center of the footer!}
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyfoot[c]{center of the footer}
\renewcommand{\footrulewidth}{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}


Something like this does what you want I think.

\documentclass[oneside]{report}
\usepackage{fancyhdr}
\pagestyle{fancy}

\begin{document}

\chapter{Aaaaa}
\section{fooo}
zzzz
\clearpage
\section{fooooo}
zzzz

\chapter{Bbbbb}
\section{fooo}
zzzz
\clearpage
\section{baaaar}
zzzz

\end{document}

• Your code does not work – sam Jul 14 '17 at 20:46
• My thesis display page number on bottom of page. This code does not work – sam Jul 14 '17 at 20:48
• @sam yes my code does work, did you try the document that I posted? It makes the page heading shown in the image. If your document is doing something else then some code you have not shown is setting the page head and foot after the settings that I suggest, but as you have not provided any example document or shown any code it is hard to help more than show a working example, as above. – David Carlisle Jul 14 '17 at 21:02
• It's work in windows latex. But does not work in ubuntu texstudio. And windows latex not supported some packages. – sam Jul 16 '17 at 20:26
• @sam No. tex works and produces identical output in windows and linux, the editor you use to write the source (texstudio or emacs or notepad or..) makes no difference whatsoever. It may be you have an old distribution (but neither report nor fancyhdr has changed in ways that affect this since last century. Add \listfiles to your document, and compare the package versions on windows and linux. – David Carlisle Jul 16 '17 at 20:34