TeX - LaTeX Asked by jamaicanworm on March 14, 2021
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}{dimexprtextwidth+marginparsep+marginparwidthrelax}
makerunningwidth{mystyle}{headwidth}
makeevenhead{mystyle}{itshapeleftmark}{}{}
makeoddhead{mystyle}{}{}{itshapeleftmark}
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}
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
letorigps@chapterps@chapter
pretofrontmatter{letps@chapterps@emptypagestyle{empty}}
pretomainmatter{%
cleardoublepage
letps@chapterorigps@chapterpagestyle{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.
Correct answer by egreg on March 14, 2021
Memoir provides aliaspagestyle{}{}
for this purpose:
documentclass{memoir}
begin{document}
frontmatter
pagestyle{empty}
aliaspagestyle{chapter}{empty}
title{My Book}
author{Me}
maketitle
mainmatter
% aliaspagestyle{chapter}{ruled}
pagestyle{ruled}% <-- for example
chapter{A Chapter}
Some text.
end{document}
Answered by jon on March 14, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP