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.

What is the best way to customize the headings at the top of each page in a memoir document? For example, if I want just the page number at the top of every left page, and just the chapter title (say, in italics) at the top of every right page? What if I don't want any header on left pages, but just the page number as a footer in the corner?

share|improve this question
6  
The best way would be to use memoir's header typesetting styles. :) This is described in detail in the memoir documentation (section 7.2 Page styles, starting on p 118). –  Werner Dec 16 '11 at 0:38
4  
There is also my PracTeX Journal article about the memoir page styles: tug.org/pracjourn/2008-2/madsen –  daleif Dec 16 '11 at 9:51

1 Answer 1

up vote 13 down vote accepted

As Werner comments, the best way to customize the headers/footers when using memoir is to use the features provided by the class itself.

In the following code I created a customized page style to produce your first layout: page number at the top (I chose at the left) of even-numbered pages and chapter title in italics at the top (I chose at the right) of odd-numbered pages; since I didn't make any special provision for the plain style, the first page of every chapter will retain the default plain style:

\documentclass{memoir}
\usepackage{lipsum}

\nouppercaseheads
\makepagestyle{mystyle}
\makeevenhead{mystyle}{\thepage}{}{}
\makeoddhead{mystyle}{}{}{\itshape\leftmark}
\makeevenfoot{mystyle}{}{}{}
\makeoddfoot{mystyle}{}{}{}
\makepsmarks{mystyle}{%
  \createmark{chapter}{left}{nonumber}{}{}}

\pagestyle{mystyle}

\begin{document}
\chapter{Test Chapter}
\lipsum[1]
\section{Test Section}
\lipsum[1-20]
\end{document}

Here are the modifications required in the comments; the headers/footers will now extend to the space reserved for marginal notes; the plain style has also been redefined to match the layout for other pages:

\documentclass{memoir}
\usepackage{lipsum}

\nouppercaseheads
\makepagestyle{mystyle} 
\setlength{\headwidth}{\dimexpr\textwidth+\marginparsep+\marginparwidth\relax}
\makerunningwidth{mystyle}{\headwidth}
\makeevenhead{mystyle}{\itshape\leftmark}{}{} 
\makeoddhead{mystyle}{}{}{\itshape\leftmark} 
\makeevenfoot{mystyle}{\thepage}{}{} 
\makeoddfoot{mystyle}{}{}{\thepage} 
\makeatletter
\makepsmarks{mystyle}{%
  \createmark{chapter}{left}{shownumber}{\@chapapp\ }{.\ }}
\makeatother

\makepagestyle{plain}
\makerunningwidth{plain}{\headwidth}
\makeevenfoot{plain}{\thepage}{}{}
\makeoddfoot{plain}{}{}{\thepage}

\pagestyle{mystyle}

\begin{document}
\chapter{Test Chapter}
\lipsum[1]
\section{Test Section}
\lipsum[1-20]
\end{document}
share|improve this answer
    
After reading and experimenting around, I came up with the following (closest version to what I want): \nouppercaseheads \makepagestyle{mystyle} \makeevenhead{mystyle}{\itshape\leftmark}{}{} \makeoddhead{mystyle}{}{}{\itshape\leftmark} \makeevenfoot{mystyle}{\thepage}{}{} \makeoddfoot{mystyle}{}{}{\thepage} \makepsmarks{mystyle}{\createmark{chapter}{left}{}{}{}} But here the headers on each page say 1Test Chapter. What is the best way to get them to say Chapter 1: Test Chapter (still in italics)? Thanks! –  jamaicanworm Dec 16 '11 at 16:31
1  
@jamaicanworm: see my updated answer. –  Gonzalo Medina Dec 16 '11 at 17:20
1  
@jamaicanworm: do you want only the footer on the first page of chapters or also the header? –  Gonzalo Medina Dec 16 '11 at 20:24
1  
@jamaicanworm: see again my updated answer. –  Gonzalo Medina Dec 16 '11 at 21:07
1  
@jamaicanworm: You're welcome! –  Gonzalo Medina Dec 17 '11 at 2:42

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.