[Tex/LaTex] Centered page numbers with headers in memoir class

header-footermemoir

I am in hurry and I really need to know how to style the page in memoir class. All the examples in page style such as Rule,empty, headings and Plain doesn't give the combination I need. Plain styles is the closest as it give bottom centered page numbers but without headers. I need both headers and page numbers at bottom centered on every page.

Can anybody please give me solution?

Best Answer

Here is a very plain template to set all the headers and footer in memoir. It's taken almost verbatim from the memoir documentation (section 7.3 MAKING HEADERS AND FOOTERS):

enter image description here

\documentclass{memoir}
\usepackage{lipsum}

\makepagestyle{hurried}% Create hurried page style
\makeevenfoot{hurried}% Adjust even footer for hurried page style
  {LEF}% Left even footer
  {CEF}% Center even footer
  {REF}% Right even footer
\makeevenhead{hurried}% Adjust even header for hurried page style
  {LEH}% Left even header
  {CEH}% Center even header
  {REH}% Right even header
\makeoddfoot{hurried}% Adjust odd footer for hurried page style
  {LOF}% Left odd footer
  {COF}% Center odd footer
  {ROF}% Right odd footer
\makeoddhead{hurried}% Adjust odd header for hurried page style
  {LOH}% Left odd header
  {COH}% Center odd header
  {ROH}% Right odd header
\makeheadrule{hurried}{\textwidth}{.4pt}% Header rule width/thickness for hurried page style
\makefootrule{hurried}{\textwidth}{.4pt}{\footruleskip}% Footer rule width/thickness/skip for hurried page style

\pagestyle{hurried}% Set page style to hurried

\begin{document}

\frontmatter
\tableofcontents

\mainmatter

\chapter{A chapter}\lipsum[1-10]
\section{A section}\lipsum[1-10]
\subsection{A subsection}\lipsum[1-10]
\subsubsection{A subsubsection}\lipsum[1-10]

\end{document}

If you don't want to be as extravagant and set everything, you can \copypagestyle from an existing one (like Ruled, ruled, plain, ... any of the ones mentioned in section 7.2 PAGE STYLES).

Note that first pages of chapters in memoir are set in the chapter page style. chapter is not a true page style, but rather an alias for plain. If you wish to change that, first \copypagestyle{chapter}{plain}, making chapter a true page style, then use the above techniques. For example, to get the page number in the center of the first chapter page, use

\copypagestyle{chapter}{plain}% Copy plain page syle to chapter page style
\makeoddfoot{chapter}% Adjust odd footer for chapter page style
  {}% Left odd footer
  {\thepage}% Center odd footer
  {}% Right odd footer
Related Question