Hello I am new to LaTeX and I am having a problem using fancyhdr package I want the header to only show the chapter number and chapter name in the center of the page and I am having issues doing that the code I am using is

\rhead{}
\cfoot{\thepage}
\renewcommand{\footrulewidth}{0.4pt}


where the XXXXX is suppose to be changed to a specific code i tried using \thechapter . \chaptername hoping it would show something like 'Chapter 2.Theoratical Background' but it only shows the number and nothing else I am probably making a mistake with the syntax can someone please help me out. Thank you

• \chaptername is Chapter usually, but not the title of the chapter. For more on this, it requires the knowledge of the documentclass – user31729 Jul 22 '15 at 22:43
• \documentclass[12pt, a4paper, twoside]{Report} this is my document class sorry if I am a noob I am new to LaTeX – Bakhtawar Khattak Jul 22 '15 at 22:45

I am not sure this is really what the the OP wants to have, but the chapter title is contained in \leftmark (if I remember correctly)

\documentclass[12pt,a4paper,twoside]{report}

\usepackage{fancyhdr}

\cfoot{\thepage}
\renewcommand{\footrulewidth}{0.4pt}

\usepackage{blindtext}

\pagestyle{fancy}

\begin{document}

\chapter{My first Chapter}
\blindtext[10]

\end{document}

• omg thank you so much this worked. i love you i wish i could send you a cookie through this wonderful site with this awesome community – Bakhtawar Khattak Jul 22 '15 at 22:55
• @BakhtawarKhattak -- Upvoting is the preferred way here to say "thank you" to users who helped you. You might also accept an answer that solved your issue best (just in case you get another answer), which does not mean that you can't upvote Christian's answer if it remains the only one. – Ruben Jul 23 '15 at 1:21
• @Ruben I think stackexchange should switch to sending cookies for showing appreciation. – Jonathan Komar Jul 23 '15 at 8:26
• @BakhtawarKhattak -- I think so, too. Yet we still have the reputation system. But please let me know if you start a poll to change it. I'll join or at least support your campaign. – Ruben Jul 23 '15 at 10:59
• lol I am new to this website how do u upvote someone? I would like to upvote the crap out of this amazing helpful person :D – Bakhtawar Khattak Jul 24 '15 at 14:30