# memoir class: how to set \pagestyle on blank page that gets inserted before a new chapter?

I am typesetting a book in LaTeX, using the memoir document class.

As a preference, I am using openright, so that chapters begin on righthand (Recto) pages.

Situation: Using this preference, LaTeX will insert a blank page prior to a new chapter, when necessary, so that the new chapter will open on a righthand page. However, this blank page that gets inserted prior to the chapter is completely blank - no page number or anything. (\pagestyle{empty})

My overall question: How do I make it, so that this blank page, has a page number on it? (\pagestyle{plain})

Below I have provided the details on what I did to try to solve this issue, and further refined the question. But first here is a simple tex file to demonstrate the issue, along with a picture which shows how the resulting document looks.

\documentclass[a4paper,smalldemyvopaper,12pt,twoside,onecolumn,operight,extrafontsizes]{memoir}
\usepackage[utf8x]{inputenc}
\usepackage[osf]{Alegreya,AlegreyaSans} % this will give the nice font

% title page
\title{This is an example document}
\author{Just Another Brick in the Wall}

\begin{document}

\maketitle
\clearpage
\tableofcontents

\mainmatter

\chapter{A Chapter With No Blank Page Inserted Before It}

No blank page will get inserted prior to this chapter, because it already begins on a righthand (Recto) page naturally.

\chapter{A Chapter That Gets a Blank Page Inserted before it}

Because the previous chapter ended on a righthand page, a blank page will get inserted before this chapter begins, so that it will start on a righthand page. Notice how there is no page number on that blank page - I'd like to change that somehow!

\end{document}


This is what the resulting pdf looks like (Notice on page 4/5, there is no page number - that is what I would like to change!)

Here is what I tried; it should refine the question a bit: I looked at the source code for the memoir class, to understand how the \chapter macro works. I looked at the source code here (please correct me if I'm looking at the wrong code): http://ctan.mirrors.hoobly.com/macros/latex/contrib/memoir/memoir.dtx

If you search in that link for \newcommand\chapter, you will find the macro defined. At the beginning of the \chapter macro, there is a command \clearforchapter. As I understand from the memoir class documentation, \clearforchapter is a command which will set the chapter on to the correct page (insert the blank page for me, I'm assuming). So, I thought maybe this command sets a \pagestyle{empty} and that I could redefine it. However, searching the source code, I can't find where \clearforchapter command is defined.

Therefore, here are two more specific questions which might solve the problem:

(1) Does anyone know if there is a simple option, which will instruct LaTeX to use a 'plain' pagestyle, for dummy pages that get inserted before a chapter? (Similar to how you can do \aliaspagestyle{afterpart}{plain} in the preamble, to change the pagestyles of the blank page that comes after 'part')

(2) Does anyone know where this \clearforchapter macro is defined? Is it part of another class? (So I can look at what it does and try to redefine it? I'm wondering if it has a \pagestyle{empty} in it)?

Thank you very much. I am new to this and appreciate your help.

Memoir uses the page style cleared for these pages (see manual page 106). With

\aliaspagestyle{cleared}{plain}


in your preamble (see page 109) you can set it to plain.


• I believe the problem now is, when I do this, indeed the alias pages prior to the chapters now have page numbers. (thank you!) However, this also means that the page on the back of my title page (2nd page in doc) has a page number as well now, as it is also an alias for a chapter (As far as I am aware). Unfortunately I wish to keep that page clear. I wonder if there is a way to restrict this behavior only to certain chapters? (to have \aliaspagestyle{cleared}{plain} in preamble, but specifically for the chapter immediately proceeding title, to have the 'empty' style) Jul 18, 2017 at 1:14
• and thanks for the information contained in your post (pointing to right direction in the manual, as well as searching for macros!) this is very useful to me as I am learning. (this was in the comment I deleted!) Jul 18, 2017 at 1:16
• my edit is unfortunately incorrect - that blank page after the title page, I think comes from the title page itself (not due to the chapter that comes after it). However, it is still affected by \aliaspagestyle{cleared}{plain}. I specifically need to target just that single page (page 2 in document) and force it to be cleared - I thought of trying \clearpage \thispagestyle{clear} immediately after the title, but that unfortunately does not work. I will keep trying. (sorry for all the edits, I just wanted to correct myself in case anyone else runs in to a similar problem!) Jul 18, 2017 at 1:38
• A better way might be to redefine memoir's \memendofchapterhook and/or\clearforchapter macros. These are called at the end of a chapter, and at the start of the next chapter. By default \memendofchapterhook does nothing and \clearforchapter just calls \cleartorecto, \cleartoverso or \clearpage depending what open... option you selected, but they can do anything you like. See the memoir documentation section 6.5. Jul 18, 2017 at 4:04
• @ffConundrums: if you move \aliaspagestyle{cleared}{plain} from the preamble to right after \mainmatter, cleared pages before will stay empty. And the pagestayle for pages without header and footer is empty (AFAIK there is no pagestyle clear).
– Mike
Jul 18, 2017 at 20:12