# How can I remove chapter 0 in the front matter (acknowledgement, toc,nomenclature) when using fancyhdr

These are my settings for fancyhdr:

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}


Under the default book document class, this is what \frontmatter does:

\newcommand\frontmatter{%
\cleardoublepage
\@mainmatterfalse
\pagenumbering{roman}}


Note that it sets a conditional - \if@mainmatter - to false. We can use this as part of the header setting:

\documentclass{book}

\usepackage{fancyhdr,lipsum}

\pagestyle{fancy}
\makeatletter
\makeatother
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}

\begin{document}

\frontmatter

\chapter{Front matter chapter}
\lipsum[1-10]

\mainmatter

\chapter{Main matter chapter}
\lipsum[1-10]

\end{document}


Simply instead of using this command :

fancyhead[RE]{Chapter \thechapter}

you only have to modify the case in which you would like to visualize the chapter :

\fancyhead[RE]{\ifnum \value{chapter}>0
Chapter \thechapter\fi}