# Memoir changes page number from bottom to top-right in pages with heading

I'm using memoir with the companion page style and the madsen chapter style.

\documentclass[11pt, openany, oneside]{memoir}  %Start chapter in even or odd page
\usepackage[utf8]{inputenc} %Carácteres españoles
\usepackage[spanish]{babel} %Traducción de Título, Seccion, etc.

\setcounter{secnumdepth}{2} %Profundidad de Numeracion de titulos
\setcounter{tocdepth}{2}        %Profundidad de Numeracion de TOC

\pagestyle{companion}
\chapterstyle{madsen}       %Chapter style

\setcounter{chapter}{-1}        %Comenzar a numerar en 0

\usepackage{epsfig}         %??

%\setlength{\parindent}{0pt}    %Eliminar indent inicial
\nonzeroparskip         %Aumentar espacio entre párrafo

\tightlists                 %Less space betwenn item lists


On pages where there is no heading the page number is at the bottom, center position. On pages with heading the page number is at the top, left position.

Is this the default behaviour? I don't like it at all.

Is there a way to make it consistent through all document? I would prefer bottom-center.

Note: I have tried to read the Memoir class documentation but it is a bit hard for me.

-
Never use the epsfig package, which is in the distributions only for typesetting old documents. Prefer graphicx with its much more powerful commands. – egreg Sep 29 '12 at 15:26
every class file i've ever seen has a specific page style for the first page of a chapter, which may or may not be (and usually isn't) the same as the page style for non-first pages. so if a different style is wanted from the one that's built in, it means doing something special: changing the \chapter macro (or one it calls to assign the page style), using \thispagestyle{...} explicitly, or (if such an option is available) selecting a particular alternative style offered by the class file. – barbara beeton Sep 29 '12 at 15:42

## 2 Answers

It is standard to use another pagestyle on pages with a chapter heading. You can use same pagestyle on these pages by

\pagestyle{X}
\aliaspagestyle{chapter}{X}


where X is the pagestyle. If I understand you correctly you want something like this:

\documentclass{memoir}

%%% HEADER AND FOOTER

\makepagestyle{standard} %Make standard pagestyle

\makeatletter                 %Define standard pagestyle
\makeevenfoot{standard}{}{\thepage}{} %
\makeoddfoot{standard}{}{\thepage}{}  %
\makeevenhead{standard}{\leftmark}{}{}
\makeoddhead{standard}{}{}{\rightmark}
\makeheadrule{standard}{\textwidth}{\normalrulethickness}
\makeatother                  %

\makeatletter
\makepsmarks{standard}{
\createmark{chapter}{both}{shownumber}{\@chapapp\ }{ \quad }
\createmark{section}{right}{shownumber}{}{ \quad }
\createplainmark{toc}{both}{\contentsname}
\createplainmark{lof}{both}{\listfigurename}
\createplainmark{lot}{both}{\listtablename}
\createplainmark{bib}{both}{\bibname}
\createplainmark{index}{both}{\indexname}
\createplainmark{glossary}{both}{\glossaryname}
}
\makeatother                               %

\nouppercaseheads
\pagestyle{standard}               %Choosing pagestyle and chapter pagestyle
\aliaspagestyle{chapter}{plain}    %Change plain to standard if you want the header on pages with chapter headings

\usepackage{lipsum}

\begin{document}

\frontmatter
\chapter{Preface}
\lipsum

\mainmatter
\chapter{First Chapter}
\lipsum
\section{A section}
\lipsum

\section{Second Chapter}

\lipsum

\end{document}

-
That gets exactly the layout I want. Still can't understand the code, but I'm on it. Thanks. – David Casillas Oct 1 '12 at 7:55

That's the behaviour of the companion pagestyle. The memoir manual offers a number of pagestyles, described in section 7.2.

You may like to try one of these:

\pagestyle{ruled}


or

\pagestyle{plain}


This last one is, approximately, the "default".

If you want to tweak page styles, the best way is to create your own. This is described in section 7.3.

Here's a very simple example which might get close to what you need:

\copypagestyle{mine}{ruled}
\makeevenfoot{plain}{}{\thepage}{}
\makeoddfoot{plain}{}{\thepage}{}
\pagestyle{mine}

-
plain or ruled page styles put the number on the bottom-left, not botom-center and give no header on top so I should base on this an tweek things a bit. Lets see if I can get it from the manual. – David Casillas Sep 29 '12 at 17:36
I think you'll find that plain` puts the folio bottom-centre. Also, the first page of a chapter is normally different from the subsequent pages. – Brent.Longborough Sep 29 '12 at 17:56
You should be right but I'm getting bottom, right page numbers. Since I have get a correct solution from @ipsem I will not go deep into this. Thanks. – David Casillas Oct 1 '12 at 8:00
@DavidCasillas : I didn't want to push you too deep into defining full sets of headings, but as you seem to be OK, that's fine; the main objective is to solve your problem. – Brent.Longborough Oct 1 '12 at 8:40