How would you have a page heading so that on the Left hand page you might have the Book the Part and the Chapter and on the right hand page have a Section any existing subsection.

From reading the Memoir manual and http://tug.org/pracjourn/2008-2/madsen/madsen.pdf it appears you can only put one item into the header at a time via the \rightmark \leftmark.

so just to be clear I would like something like:

Page Number • Part Title • Chapter Title | Section Title • Subsection Title • Page Number

where the vertical bar is the page gutter

  • Yes, it is possible.
    – cfr
    Commented Mar 3, 2015 at 1:46
  • No: you use the \...mark commands in your \make...head commands. The former only contain one 'thing', but you can put all sorts of arbitrary stuff in the latter.
    – jon
    Commented Mar 3, 2015 at 2:01
  • I realize this, I was just trying to show the result I was after... so I edited the question in an attempt to make it clearer
    – theobear
    Commented Mar 3, 2015 at 2:38

1 Answer 1


it appears you can only put one item into the header at a time via the \rightmark \leftmark.

That is true, but not the whole truth. You can work round it by concatenating several data items into a mark, and then selecting the appropriate item when you print the header.

Since parts and chapters are unlikely to be less than 2 pages long, you can remember the titles in normal macro definitions, or you could pack them into \leftmark in the same way this packs the section and subsection titles into \rightmark

This is the bare bones of a solution to show the basic idea. Adding the functionality cleanly to the standard \part, \chapter, etc, commands is an independent sub-problem.



% Define some commands so we can renew them later

% This is intentionally over-simple code, but packaging the additions cleanly into
% \part, \section, etc doesn't add value to explainng what to do.

% Assuming that chapters will cover at least two pages, we can just save the
% part and chapter titles withouut using marks.


% We also need to save the section title, so we can use it when we start
% each subsection

% In the subsection, pack the two titles into the mark, with a unique separator @@@
% Note: you probably want to add a \markright commmand to \mysection as well, 
% in case you have a section with no subsections.

  {\subsection{#1}\markright{\savesection @@@#1}}

% Finally, define the headings, and extract the two substrings from the \rightmark




\mypart{Part A}
\mychapter{Chapter One}
\mysection{Sec 11}
\mysubsection{SubSec aaa}
\mysubsection{SubSec bbb}
\mysubsection{SubSec ccc}
\mypart{Part B}
\mychapter{Chapter Two}
\mysection{Sec 22}
\mysubsection{SubSec ddd}
\mysubsection{SubSec eee}
\mysubsection{SubSec fff}


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .