Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Using memoir class on a (lengthy) document, I want to customise headers, however (having spent several hours of trial and error) I'm presently stumped when it comes to the nuances required. Can anyone point me in the right direction?

I enclose my MWE. The customised page style ('mpd') provides:

  • an even page header of 'Chapter (number, name etc)' and
  • an odd page header of 'Section'.

I want to

  • switch the 'Chapter (etc)' to the odd page and
  • make the even page header show the document (book) title.

There does not seem to be any reference to document title within Memoir Page Styles, which I have consulted widely in my efforts. Yet it seems like something that should be readily achievable?

Many thanks for any input offered.

\documentclass[a5paper]{memoir}
\usepackage{lipsum}
                            %   ------------------------    
                            %   new style: mpd
                            %   copied from headings style
                            %   with no caps in headers 
\copypagestyle{mpd}{myheadings}     
\addtopsmarks{mpd}{\nouppercaseheads}
    {\createmark{chapter}{left}{shownumber}{\chaptername \space}{ : }
     \createmark{section}{right}{nonumber}{}{}
    }%
\makeoddhead{mpd}{\slshape\rightmark}{}{}
\makeevenhead{mpd}{}{}{\slshape\leftmark}
\makeevenfoot{mpd}{\thepage}{}{\itshape{republished under licence}}
\makeoddfoot{mpd}{\itshape{www.domain.info}}{}{\thepage}    
\pagestyle{mpd} 

\begin{document}    
\tableofcontents*
\pagestyle{mpd}
\mainmatter

\chapter{Introduction}
\label{introduction}
    \section{Section 1}
    \label{section1}
        \lipsum[1]      
        \lipsum[2]      
        \lipsum[3]      
        \lipsum[4]      
        \lipsum[5]      
        \lipsum[1]      
        \lipsum[2]      
        \lipsum[3]      
        \lipsum[4]      
        \lipsum[5]      
        \lipsum[1]      
        \lipsum[2]      
        \lipsum[3]      
        \lipsum[4]      
        \lipsum[5]      
\end{document}
                            %   ------------------------    
share|improve this question
    
\makeoddhead{mpd}{\slshape\leftmark}{}{} \makeevenhead{mpd}{}{}{\slshape\mytitle} \def\mytitle{The title} –  Gonzalo Medina Aug 11 at 16:37
    
Super. Thank you (again!), @GonzaloMedina. Felt it had to be simple %) –  johnbrc Aug 11 at 16:41

1 Answer 1

up vote 5 down vote accepted

Use \leftmark for the odd head; store the title in \mytitle and use it for the even head:

\makeoddhead{mpd}{\slshape\leftmark}{}{} 
\makeevenhead{mpd}{}{}{\slshape\mytitle} 
\def\mytitle{The title}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.