Modify the chapter mark

fancyhdrheader-footersectioningtable of contents

I have an incorrect chapter mark in a page. I inserted an unnumbered chapter (\chapter*{History} and I get "List Of Figures" as the chapter in the current position.

How can I change it?

The code:

\documentclass{memoir}
\usepackage{lipsum}
\usepackage{fancyhdr}
\makepagestyle{fancy}

\makeatletter
\makepsmarks{fancy}{%
\createmark{chapter}{left}{shownumber}{\@chapapp\ }{\ \ }
}
\makeatother


\makeoddhead{fancy}{}{}{{\fontsize{9.13}{10}\selectfont%
\leftmark}%
\hspace{0.6cm}{\textbf{\thepage}}}

\makeevenhead{fancy}
{\textbf{\thepage}\hspace{0.6cm}{\fontsize{9.13}{10}\selectfont{%
            My book title}}}{}{}

\begin{document}
\pagestyle{fancy}
\listoffigures
\cleardoublepage
\chapter*{History}
\lipsum[3-12]
\end{document}

The last page in the output:

output

At the moment I have a bit of hard time learning the different marks in latex (markboth, markright, rightmark etc.) and therefore I bring my question here.

I am positive that this question has already an answer here on the site. It is just that I am new to this subject and don't have an idea what the keywords are to make a search.

Best Answer

  1. You shouldn't load fancyhdr package because you are using memoir's mechanisms for the headers/footers.
  2. After \chapter*{History} put \markboth{History}{} to get the right header.
\documentclass{memoir}
\usepackage{lipsum}
\makepagestyle{fancy}

\makeatletter
\makepsmarks{fancy}{%
\createmark{chapter}{left}{shownumber}{\@chapapp\ }{\ \ }
}
\makeatother


\makeoddhead{fancy}{}{}{{\fontsize{9.13}{10}\selectfont%
\leftmark}%
\hspace{0.6cm}{\textbf{\thepage}}}

\makeevenhead{fancy}
{\textbf{\thepage}\hspace{0.6cm}{\fontsize{9.13}{10}\selectfont{%
            My book title}}}{}{}

\begin{document}
\pagestyle{fancy}
\listoffigures
\cleardoublepage
\chapter*{History}
\markboth{History}{} %<<<<<<<<<<<<<<<<<<<<<
\lipsum[3-12]
\end{document}
Related Question