# Chapter name in the header with \chapter*

I need to display the chapter name with the \chapter* command to the left side of the header. This is one example of what I tried:

    \documentclass[12pt,a4paper,oneside]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}

\begin{document}
\chapter*{\centerline{Chapter Name}}

\end{document}


How can I do this?

-

Try

\chapter*{chapter name}
\markboth{chapter name}{}


And consider using titlesec package rather using \centerline as a visual formatting approach.

-
Ok, using this command in the header appears "Chapter0. Chapter Name". I would like having only the chapter name, without "Chapter0". – Ford Prefect Jan 8 '13 at 20:31
@FordPrefect sorry. comes from not thinking ... nice to get 3 votes for a wrong solution. People give too much credit :-) – Frank Mittelbach Jan 8 '13 at 20:55

Setting the headers with fancyhdr usually requires changing the \chaptermark and \sectionmark commands; you don't need the latter, as you want only the chapter title in the header.

Here's an example in which I show two methods. A simple \chapter command in the \frontmatter will not give a numbering and correctly set the header. If you want the unnumbered chapter in the \mainmatter, then you can use an explicit \chaptermark command.

\documentclass[12pt,a4paper,oneside]{book}

\usepackage{fancyhdr}
\pagestyle{fancy}

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}

\fancyhf{} % clear the headers
% We want italics
\itshape
% The chapter number only if it's greater than 0
\ifnum\value{chapter}>0 \chaptername\ \thechapter. \fi
% The chapter title
\leftmark}
\fancyfoot[C]{\thepage}

\fancypagestyle{plain}{
\fancyhf{}
\fancyfoot[C]{\thepage}
}

\usepackage{kantlipsum} % for the mock text

\begin{document}

\frontmatter

\chapter{Introduction}

\kant

\mainmatter

\chapter*{Another introduction}
\chaptermark{Another introduction}

\kant

\chapter{Title}

\kant

\end{document}


Note that if you plan to use appendices, one of the commands should be modified:

\makeatletter
% We want italics
\itshape
% The chapter number only if it's greater than 0
\ifnum\value{chapter}>0 \@chapapp\ \thechapter. \fi
% The chapter title
\leftmark}
\makeatother


(Unfortunately, the command that holds either \chaptername or \appendixname is an internal one, so one has to do some tricks to access it.)

Note also the \setlength{\headheight}{14.5pt} to give the header the room it needs.

For centering the chapter title it's better to use the methods of the titlesec or sectsty packages than doing explicit formatting.

Note This assumes that the unnumbered chapter is in the \frontmatter (any number of them, actually) or there is only one at the beginning of the \mainmatter. For other cases a more complex approach should be taken.

-