# \markboth is not working when using \chapter and \section

I am having a problem when adding \chapter and \section in the document. \markboth is not working when I compile it. I have got a link Why is \markboth not working?. But there is no solution about my problem. I have written the following code:

\documentclass[a4paper,12pt]{book}
\usepackage{fancyhdr,amsthm}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}[theorem]{Corollary}
\fancyfoot{}
\pagestyle{fancy}
\begin{document}
\markboth{Chapter}{Section}
\thispagestyle{empty}
\chapter{ Chapter}
\section{Section}

\begin{theorem}
Theorem
\end{theorem}

\newpage
Second page
\newpage

Third page
\end{document}


This produces:

But I want to get the following output:

How can I solve this problem ?

• If it is not possible in this way , tell me alternative way. – Soumitra Sen Apr 28 '13 at 18:08
• Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – jub0bs May 9 '13 at 12:41

You have to redefine \chaptermark and \sectionmark (after doing \pagestyle{fancy}). I have also reorganized a bit the code.

\documentclass[a4paper,12pt]{book}

\usepackage{fancyhdr,amsthm}

\pagestyle{fancy}
% We don't want chapter and section numbers
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}

\fancyfoot{}

\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}[theorem]{Corollary}

\begin{document}

\chapter{Chapter}
\section{Section}

\begin{theorem}
Theorem
\end{theorem}

\newpage
Second page
\newpage

Third page
\end{document}