# \currentitle in memoir class header prints next section title

I have a weird problem with the memoir class.

I'm using it to typeset a book of short stories. I have the headers set up so that the page numbers are printed on the outer side. On the left-hand page, the book title is printed right-justified; on the right-hand page the title of the current story appears on the left. As far as I know, this is fairly usual. It looks like this:

Page number --- Book title | Story title --- Page number

The book title is inserted statically, i.e. not using any kind of command like \title. To get the story title I use \currenttitle thus:

\makeoddhead{headings}{\emph{\MakeUppercase{\currenttitle}}}{}{\thepage}


This all works fine except when a story finishes at the bottom of a right-hand page. Instead of printing that story's title in the header of that page, memoir uses the title of the story that begins overleaf!

I've not posted a minimal example, as the error obviously only occurs when you have the 'right' amount of text to fill up a few pages, but it is a reproducible error in the sense that it happens three times in this document with 30 stories in it.

Instead of a minimal example, here's the preamble:

\documentclass[postvopaper,twoside,10pt]{memoir}
\raggedbottom

\usepackage{fontspec} % Font selection for XeLaTeX; see fontspec.pdf for documentation
\defaultfontfeatures{Mapping=tex-text} % to support TeX conventions like \Emdash*''
\usepackage{xunicode} % Unicode support for LaTeX character names (accents, European chars, etc)
\usepackage{xltxtra} % Extra customizations for XeLaTeX
\usepackage{ellipsis}

\setmainfont{Lido STF} % set the main body font (\textrm)
\usepackage{amssymb,amsmath}
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\setcounter{secnumdepth}{0}

\usepackage{graphicx}
\usepackage{covington}
\usepackage{enumitem}
\setlist[description{style=multiline,labelwidth=60pt,leftmargin=70pt%,itemindent=\dimexpr-20pt-\labelsep\relax
}

\usepackage{extdash}

% reduce size of footnote marker
\makeatletter
\renewcommand{\@makefnmark}{\hbox{\textsuperscript{\tiny{\@thefnmark}}}}
\makeatother

%%% PAGE LAYOUT

\setlrmarginsandblock{0.15\paperwidth}{*}{1} % Left and right margin
\setulmarginsandblock{0.2\paperwidth}{*}{1}  % Upper and lower margin
\sloppybottom
\checkandfixthelayout

%%-----------

\title{The Complete Annotated Reginald Stories}
\author{Saki}
\date{}

\makeevenhead{headings}{\thepage}{}{\emph{Complete Annotated Reginald Stories}}
\makeoddhead{headings}{\emph{\MakeUppercase{\currenttitle}}}{}{\thepage}
\pagestyle{headings}

• Please post a full minimal example, that makes it a lot easier to help you when we do not have to add anything to see the problem. IMO you're doing this wrong. You need to use \leftmark and \rightmark in order to access the latest sectonal title. These are usually specified using \makepsmarks, done right the \MakeUppercase will be build in as it isn't always that good as handling data stored in a macro. – daleif Apr 26 '16 at 10:01
• BTW: the kantlipsum package and its \kant macro is very handy to provide sample text – daleif Apr 26 '16 at 10:04
• I deliberately didn't give a minimal example, as the nature of the problem meant I would have had to fiddle about trying to get exactly the right amount of dummy text so that a section finished at the bottom of a page. (Otherwise the error won't occur.) Most lorem ipsum packages I know don't offer such a fine level of control. On the plus side, I changed \currenttitle to \rightmark and now it works, so thanks for your help! – Bruce Gaston Apr 27 '16 at 7:27
• Just see preparing an MWE as payment for peoples help. – daleif Apr 27 '16 at 7:49
• :-) Can you change your first comment to an answer so that I can mark the question as answered? – Bruce Gaston Apr 27 '16 at 14:01

## 1 Answer

Because of the asynchronous nature of the headers and footers, \currenttitle is not a good choice for the header. More traditionally \leftmark and \rightmark are used.

Also note that these marks are uppercase in memoir by default.

If interested you can have a look at the headings style code in the memoir sources, \makepsmarks and how it is used might be interesting.

There is also an article about memoir pagestyles in the PracTeX Journal, http://tug.org/pracjourn/2008-2/madsen/