# I need help in getting chapter title (without number) to display in header

I want my two-sided pages to have different headers: on the left (even) side, the title of the book, and on the right (odd) side, the chapter title, without number. (This is pretty normal for non-technical books.)

I adapted my code from Werner's answer to Dave's 2015 question "Add Chapter Title to Header - without “Chapter 1” without success. The left (even) header is fine, but all I get is a separation line on the top of the right (odd) pages with no chapter title.

See minimum (non-)working example below. Is the problem in line 6? Do I need to rearrange some lines? I've searched sundry places including the fancyhdr documentation without success. Thanks in advance, Artmancc

\documentclass[12pt]{book}
\usepackage{fancyhdr,lipsum}
\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\fancyhead[CO]{\leftmark}  %%% Is this the problem?
\fancyfoot[LE,RO]{\thepage}

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

\begin{document}

\chapter*{First Chapter}
\lipsum[1-9]
\clearpage{\pagestyle{empty}\cleardoublepage}  %% no header on blank left page
\chapter*{Last Chapter}
\lipsum[10-18]

\end{document}


The starred version \chapter* does not execute \chaptermark. So you have to add this command for each starred chapter:

\documentclass[12pt]{book}
\usepackage{lipsum}% only for dummy text
\usepackage{emptypage}% page style empty on blank pages

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\fancyfoot[LE,RO]{\thepage}

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

\begin{document}

\chapter*{First Chapter}\chaptermark{First Chapter}
\lipsum[1-9]
\chapter*{Last Chapter}\chaptermark{Last Chapter}
\lipsum[10-18]

\end{document}


The result for this example is the same as above.

But if there are no numbered chapters, sections etc in the document, it would be better to change counter secnumpdepth and use the unstarred version \chapter:

\documentclass[12pt]{book}
\usepackage{lipsum}% only for dummy text
\usepackage{emptypage}% page style empty on blank pages

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\fancyfoot[LE,RO]{\thepage}

\setcounter{secnumdepth}{-1}% only parts will be numbered

\begin{document}

\chapter{First Chapter}
\lipsum[1-9]
\chapter{Last Chapter}
\lipsum[10-18]

\end{document}


It is easy with titleps which comes with titlesec:

\documentclass[12pt]{book}
\usepackage{lipsum}
\usepackage{titleps}
\newpagestyle{myfancy}{%
\setfoot[\thepage][][]{}{}{\thepage}
}
\renewpagestyle{plain}{%
\setfoot[\thepage][][]{}{}{\thepage}
}

\begin{document}
\pagestyle{myfancy}

\chapter*{First Chapter}
\chaptermark{First Chapter}
\lipsum[1-9]
\clearpage{\pagestyle{empty}\cleardoublepage} %% no header on blank left page
\chapter*{Last Chapter}
\chaptermark{Last Chapter}
\lipsum[10-30]

\end{document}


• Thanks, I'm going to try this out. But I still want to know — if only as a learning exercise — why my code failed. Aug 19 '20 at 20:48
• For your try, don't load both fancyhdr and titleps – they're incompatible. Aug 19 '20 at 21:00