[Tex/LaTex] Suppress introductory page numbers

memoirpage-numbering

I have a memoir document with introductory material (title page, table of contents, etc.) in the \frontmatter section. How do I prevent page numbers from automatically being put on these pages (currently they are roman numerals)? I still want normal arabic page numbers on every page in the \mainmatter section.

\documentclass{memoir}
\begin{document}

\frontmatter
\title{My Book}
\author{Me}
\maketitle

\mainmatter
Some text.

\end{document}

I am aware that I can switch page numbers on and off with \pagenumbering{gobble} and \pagenumbergin{arabic}. But I'm looking for a memoir setting which will automatically turn off page numbering for the \frontmatter section. (I'm asking because main document has lots of settings which seem to conflict with \pagenumbering{gobble} and generate warnings.)

EDIT:

As egreg pointed out, these warnings in my main document are generated by a conflict with the hyperref package.

EDIT 2:

If possible, I would like to remove the numbers from all pages in \frontmatter, but keep the page numbers in \mainmatter using my custom header and fooder settings:

% Headers and Footers

\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}
\makepsmarks{mystyle}{\createmark{chapter}{left}{}{}{}}

\makeatletter
\makepsmarks{mystyle}{\createmark{chapter}{left}{shownumber}{\@chapapp\ }{:\ }}
\makeatother

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

\pagestyle{mystyle}

Best Answer

The warnings are probably caused by hyperref, because you're not generating the page numbers that the package needs for setting anchors. It's probably better to redefine the page style for frontmatter to empty:

\documentclass{memoir}
\usepackage{hyperref,kantlipsum,etoolbox}

\makeatletter
\aliaspagestyle{title}{empty} % suppress the page number after \maketitle
\let\origps@chapter\ps@chapter
\preto\frontmatter{\let\ps@chapter\ps@empty\pagestyle{empty}}
\preto\mainmatter{%
  \cleardoublepage
  \let\ps@chapter\origps@chapter\pagestyle{headings}}
\makeatother

\begin{document}

\frontmatter
\title{My Book}
\author{Me}
\maketitle

\tableofcontents*

\chapter{Intro}
\kant

\mainmatter

\chapter{First}
\kant
\end{document}

Change headings into mystyle if you want to use this one in the main matter.


Personally I find it a bad idea to suppress page numbers: every page should have a printed number, in order to help the reader in consulting the document. Only some special pages may be an exception (dedication or colophon, for example, but not an introduction). But this depends on the document, of course; if the frontmatter consists only of a title page and a one page table of contents the page numbers are probably not necessary. If the frontmatter has table of contents, list of figures and other material such as a preface, the pages should be numbered, in my opinion.