# How to re-define the chapter-mark without changing the Appendix heading?

The document is book class and the Appendix is added by:

 ...
\backmatter
\appendix
\chpater{Appendix A}
...
\chpater{Appendix B}
...


Using fancyhdr:

\usepackage[]{fancyhdr}
\pagestyle{fancy}
\fancyhf{}

\renewcommand{\sectionmark}[1]{\markright{\thesection ~ \ #1}}
\renewcommand{\chaptermark}[1]{\markboth{ \chaptername\ \thechapter ~ \ #1}{}}

\fancyhead[RE]{\textcolor{black} {\itshape \nouppercase  \leftmark}}%higher level \scshape  \MakeUppercase
\fancyhead[LO]{\textcolor{black} {\itshape \nouppercase  \rightmark}}
\fancyhead[RO]{\textcolor{black} {\thepage}}   %odd page


The chapter-mark is expected to be re-defined like Chapter 2 State of the art, However, the \chaptername will appear in Appendix heading.

So how to solve this issue?

-
In the book class, \backmatter will remove the "Chapter" (or "Appendix") prefix. If the question is still relevant, please add a minimal working example (MWE). –  lockstep Feb 4 '13 at 11:27
This is not a bug. You're surely defining your personalized headings, so it's necessary to know how you do it. –  egreg Feb 4 '13 at 11:35
Is the command spelled \chpater on purpose? –  T. Verron Feb 4 '13 at 12:13
@KOF The code in the question and in the last comment don't agree. Which one are you using? –  egreg Feb 4 '13 at 19:15

Add a test for the mainmatter switch to the definition of \chaptermark.

\documentclass{book}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}

\makeatletter
\renewcommand{\sectionmark}[1]{\markright{\thesection~~#1}}
\renewcommand{\chaptermark}[1]{\markboth{\if@mainmatter\chaptername\ \thechapter~~\fi#1}{}}
\makeatother

\usepackage{lipsum}

\begin{document}

\backmatter

\chapter{Appendix~A}

\lipsum[1-12]

\end{document}​

-