Page LayoutQuestions about page numbering and footers with memoir

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
ps23Rick
Posts: 3
Joined: Sat Sep 09, 2023 10:18 pm

Questions about page numbering and footers with memoir

Post by ps23Rick »

Hi all.. I'm new here but not exactly new to LaTeX.. I think the last time I used either TeX or LaTeX was about 25-30 years ago on a VAX/VMS system if anyone remembers those.

Anyway, I've got a test file below that I've snipped out of my live files in the hopes that someone could clue me in on what I'm doing wrong. I'm just trying to come up with a template for a typical chapter for a book that I told someone I'd help with and chose LaTeX over MS Word and so forth.. I believe once I've got the template figured out then the rest is fairly straightforward.

Some notes on my specific file are below for reference :

1) The first page (blank) is present just as a placeholder and can be ignored -- normally I load an image and so forth but have disabled it for this post

2) I don't want page numbers on the preface page (physical page #3), nor the contents page (physical page #4)

3) For the Introduction chapter/section II want actual page numbering to be roman numerals (right now it's not putting page info for the Introduction section)

4) The first page of Chapter 1 is missing the page number info -- but shows up on subsequent pages. I've not managed to figure out how to fix that.

5) What's the best way to put all page numbers in the center of the footer instead of alternating left/right depending on the page (per the 'ruled' style)?

6) The TOC lists Chapter 1 starting on page 3 .. but I was trying to reset the counter during the Introduction section.. if that is right I'd assume Chapter 1 would be starting on page 4.. not sure what I'm missing there..

7) In the section/chapter heading for the Introduction, on the 2nd page of introductory text, the heading says "CONTENTS" -- where is that coming from and if I want to change it to be more like what Chapter-1 does?

Any thoughts on this would be extremely helpful!

Code: Select all

\documentclass[11pt,twoside,openright,onecolumn,final]{memoir}
\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}
\usepackage[english]{babel}
\usepackage{lipsum} % Just to put in some text

%%%% BEGIN DOCUMENT
\begin{document}

	\frontmatter
	
	% get rid of page numbers for now..
	\pagestyle{empty}
	\aliaspagestyle{chapter}{empty}
	
	% create the front book cover (stubbed out)
	\newpage
	
	% =========================
	\mainmatter
	\pagenumbering{roman}	% roman numerals for now
	
	
	% \aliaspagestyle{chapter}{ruled}
	
	% We want all initial chapter pages on the right page not the left
	\cleartoverso
	
%%%% PREFACE %%%%%
\chapter*{Preface}
	\lipsum[1-3]
%%%% PREFACE  END %%%%%
	\newpage

	\tableofcontents*
	
	\setcounter{page}{0} %reset page count

	
%%%% INTRODUCTION BEGIIN %%%%%
	%\include{introduction}
	\chapter*{Introduction}
	\addcontentsline{toc}{chapter}{Introduction}
	\lipsum[1-8]
%%%% INTRODUCTION END  %%%%%
	
	
	\pagenumbering{arabic}
	\pagestyle{ruled} % <-- for example

%%%% CHAPTER 1  BEGIIN %%%%%
	% \include{chapter-1}
	\chapter{This is Chapter One...}
	\lipsum[1-48]
%%%% CHAPTER 1  END  %%%%%
	
	% ========================
	\backmatter
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
ps23Rick
Posts: 3
Joined: Sat Sep 09, 2023 10:18 pm

Questions about page numbering and footers with memoir

Post by ps23Rick »

Ok.. a few hours later and I've managed to tackle most of my bullet points .. But one is still nagging me -- in the resulting output, the first page of the Introduction and Chapter 1 there is a line at the top of the page as part of the header and nothing else. On the subsequent pages it's working as expected but this line on these two pages looks a bit odd to me and I'd like to find a way to suppress it. I'm sure it's something associated with the even/odd headers but ... Yeah, my file is a bit messy but it is 98% what I'm looking for which is an improvement. If anyone has any thoughts on making this more efficient, simplifying it or whatever, I'm all ears. I'll see about doing some cleanup and playing around with it tomorrow when my mind is fresh.. Thanks!

Code: Select all

\documentclass[11pt,twoside,openright,onecolumn,final]{memoir}
\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}
\usepackage[english]{babel}
\usepackage{lipsum} % Just to put in some text


\copypagestyle{standard}{ruled}

\makeatletter                 % Define standard pagestyle
\makeevenfoot{standard}{}{\thepage}{} %
\makeoddfoot{standard}{}{\thepage}{}  %
%\makeevenhead{standard}{}{}{\bfseries\normalfont\qquad\small\leftmark}
%\makeoddhead{standard}{\small\rightmark\qquad\bfseries}{}{}
% \makeheadrule{standard}{\textwidth}{\normalrulethickness}

% \pagestyle{empty}               % Choosing pagestyle and chapter pagestyle


%%%% BEGIN DOCUMENT
\begin{document}
	\frontmatter
	
	% get rid of page numbers for now..
	\pagestyle{empty}
	\aliaspagestyle{chapter}{empty}
	
	% create the front book cover (stubbed out)
	\newpage
%	\pagestyle{empty}
%	\aliaspagestyle{chapter}{empty}
	
	% =========================
	\mainmatter
%	\pagenumbering{roman}	% roman numerals for now
 %  \aliaspagestyle{chapter}{standard}
	\pagestyle{standard}
	
	% We want all initial chapter pages on the right page not the left
	\cleartoverso
	
%%%% PREFACE %%%%%
\chapter*{Preface}
	\lipsum[1-3]
%%%% PREFACE  END %%%%%
	\newpage

	\tableofcontents*
	
	% the following two lines are needed to ensure "CONTENT" isnt put in the header for the 
	% page right after the TOC...
%	\pagestyle{standard}
	\newpage
	\markboth{Introduction}{}
	 \aliaspagestyle{chapter}{standard}
	
%	\setcounter{page}{0} %reset page count

%%%% INTRODUCTION BEGIIN %%%%%
	%\include{introduction}
	\chapter*{Introduction}
	\addcontentsline{toc}{chapter}{Introduction}
	\lipsum[1-8]
	\clearpage
%%%% INTRODUCTION END  %%%%%
	
	
	\pagenumbering{arabic}
%	\pagestyle{standard} % <-- for example

%%%% CHAPTER 1  BEGIIN %%%%%
	% \include{chapter-1}
	\chapter{This is Chapter One...}
	\lipsum[1-48]
%%%% CHAPTER 1  END  %%%%%
	
	% ========================
	\backmatter
\end{document}
`
rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

Questions about page numbering and footers with memoir

Post by rais »

Turn \aliaspagestyle{chapter}{standard} to \aliaspagestyle{chapter}{plain}
ps23Rick wrote:

Code: Select all

    % We want all initial chapter pages on the right page not the left
    \cleartoverso
That would clear to the next even numbered page, which in a twosided layout is on the left---unless you're typesetting something that's read from right to left---if you don't believe me, open a book or two that's printed on paper and read from left to right to proove (or disproove). \cleartoverso wouldn't affect the initial chapter pages. Getting chapters to start on a right-handed side you already declared with class options twoside and openright.
In fact, this \cleartoverso was what created your initial empty page, not the (first) \newpage.

BTW: If your Introduction is supposed to get roman page numbers, I'd keep it in frontmatter. That way, not only its pagination is roman (which is set by \frontmatter), you can turn \chapter*{Introduction} into \chapter{Introduction} and drop the according \markboth and \addcontentsline commands: the memoir class limits the section numbering in \frontmatter to something somewhere above part level...

Code: Select all

\documentclass[11pt,twoside,openright,onecolumn,final]{memoir}
\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}
\usepackage[english]{babel}
\usepackage{lipsum} % Just to put in some text

% Define standard pagestyle:
\copypagestyle{standard}{ruled}
\makeevenfoot{standard}{}{\thepage}{} %
\makeoddfoot{standard}{}{\thepage}{}  %
%\makeevenhead{standard}{}{}{\bfseries\normalfont\qquad\small\leftmark}
%\makeoddhead{standard}{\small\rightmark\qquad\bfseries}{}{}
% \makeheadrule{standard}{\textwidth}{\normalrulethickness}

\begin{document}
	\frontmatter
	% get rid of page numbers for now..
	\pagestyle{empty}
	\aliaspagestyle{chapter}{empty}
	
	% create the front book cover (stubbed out)
	\cleartoverso
	\pagestyle{standard}
	
\chapter*{Preface}
	\lipsum[1-3]
	\newpage
	\tableofcontents*
	
	\aliaspagestyle{chapter}{plain}% <-- plain, not standard
	
\chapter{Introduction}
	\lipsum[1-8]
	
    \mainmatter %

\chapter{This is Chapter One...}
	\lipsum[1-48]

	\backmatter
\end{document}
If you wish the TOC to start on a right-handed (odd) side, too: replace the \newpage before it by \cleartorecto.

1 inch all around for the geometry-settings for a twosided layout looks a bit weird, too: the inner margins (right on even pages, left on odd pages) should be half of the outer margins; that way, on an opened book you'll get <m>text<m>text<m>, your way doubles the margin between the texts.

KR
Rainer
ps23Rick
Posts: 3
Joined: Sat Sep 09, 2023 10:18 pm

Questions about page numbering and footers with memoir

Post by ps23Rick »

Hey @rais!

Thanks so much for the reply and teaching me some things here in the process! I do appreciate that. Much of my "template" came from something I found on stackexchange as I recall and as such I just left it in place -- which is where the odd margins came from among other things.

Anyway, I did run your version and it works like a charm and it'll take me some time to digest everything. I'll admit that back in the day when I first ran across TeX and LaTeX it was mainly for GNU documentation for various open-source packages and I just loved looking at the resulting output but I never had the time to dig into the details of everything.. Now I can at least try to understand the mechanics of LaTeX better than I did in the past.

Thanks again for your help and I'm sure I'll probably be back on here asking silly questions in the coming days as I'm a bit under the weather at the moment..

Thanks again!

--Rick
Post Reply