2

I want to add the unnumbered part title into the headers in memoir, but \thepart command produces only the part number without the title. How would I redefine \thepart command to get the desired result?

\documentclass[11pt]{memoir}

\nouppercaseheads
\makepagestyle{mystyle}
\makeevenhead{mystyle}{}{\textit{Book Title}}{}
\makeoddhead{mystyle}{}{\textit{\thepart}}{}
\makeevenfoot{mystyle}{}{\thepage}{}
\makeoddfoot{mystyle}{}{\thepage}{}

\begin{document}
\pagestyle{mystyle}

\part{Part Title}

\include{Chapter1}
\include{chapter2}

\end{document}
Jeremy
  • 943
  • Did you have a look at the solutions proposed in http://tex.stackexchange.com/questions/75168/get-current-section-name-without-label? – jarauh Oct 14 '15 at 01:56

1 Answers1

4

Something like this, perhaps?

\documentclass[11pt]{memoir}
\usepackage{lipsum}

\nouppercaseheads
\makepagestyle{mystyle}
\makeevenhead{mystyle}{}{\textit{Book Title}}{}
\makeoddhead{mystyle}{}{\rightmark}{}
\makeevenfoot{mystyle}{}{\thepage}{}
\makeoddfoot{mystyle}{}{\thepage}{}
\clearmark{chapter}
\clearmark{section}
\createmark{part}{both}{shownumber}{\partname\space}{.\space}


\begin{document}
\pagestyle{mystyle}

\tableofcontents

\part{Part Title}

\chapter{Chapter1}
\lipsum[1-30]
\chapter{chapter2}
\lipsum[1-30]

\end{document}

The memoir trick is that you need to clear out the old marks using \clearmark, and then create a "mark" for the \part-level division.

jon
  • 22,325
  • Thanks for adding "the trick is that you need to clear out the old marks" with \clearmark. After reading documentation and other answers, it seems not at all clear to me that this would be necessary, especially when defining a brand new page style. – tsj Jul 16 '23 at 16:21