Document ClassesMemoir \markboth or \openright?

Information and discussion about specific document classes and how to create your own document classes.
Klopstick
Posts: 16
Joined: Sat Jan 27, 2007 11:18 pm

Memoir \markboth or \openright?

Post by Klopstick »

I'm seeing a strange problem in my book layout. I'm using \markboth{\thetitle}{Chapter_Name} to get my header layout to give me title and chapter name on opposing page headers, and I'm using \openright (at the beginning of each chapter - not sure if this is coorect). What's happening is that if the last page of a chapter falls on the recto page, then I see the chapter title for the next chapter on that last page. I do see the blank verso page before the tnext chapter title page, so the \openright is working correctly, or at least partially, and that blank page has no chapter name or title on it.

I'm using memoir, but I haven't declared \openright in the \documentclass line, I just do it at the beginning of each chapter. Is this what I need to do? (FYI, the chapterstyle is custom - \chapterstyle{VZ21}, if that makes any difference)

Maybe I'm confused about how to set up the initial memoir modifiers. Somebody care to put me straight?
Last edited by Klopstick on Tue Jun 10, 2008 10:38 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Memoir \markboth or \openright?

Post by Stefan Kottwitz »

Hi Klopstick,

the openright option is set by default, you don't need to declare it.
Could you provide a minimal working example showing the unwanted behaviour?

Stefan
LaTeX.org admin
Klopstick
Posts: 16
Joined: Sat Jan 27, 2007 11:18 pm

Re: Memoir \markboth or \openright?

Post by Klopstick »

Ahem. Nevermind. I had the \markboth line above the \chapter line. Moved it below the \chapter line. All fixed now... Argh!
User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Memoir \markboth or \openright?

Post by Stefan Kottwitz »

That clarifies it. I tested it before using memoir and it worked like expected.
By the way if you don't have it already you could find the memoir documentation here.

Stefan
LaTeX.org admin
Klopstick
Posts: 16
Joined: Sat Jan 27, 2007 11:18 pm

Re: Memoir \markboth or \openright?

Post by Klopstick »

Thanks Stefan,

Well, I'm getting closer to what I want, but now the frontmatter is giving me fits. It seems that no matter what I do, I can't get the first chapter to have the opening page on the recto. Latex seems to insist on inserting a blank page to foil my attempts. I've tried /cleardoublepage /newpage, etc. and even forcing a blank page (to add even one more). It seems to happen right after the TOC, I can't add a blank page after that no matter what.

Here's a somewhat sanitized sample - I've left a lot of the commented out stuff to give an idea of the things I tried plugging in. Everything works fine until I get to that first chapter page, and then it always ends up on the verso. Let me know if you need to see more of the sample - it's memoir based.


\documentclass[10pt, twoside]{memoir}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%ADJUST FOR WIDOWS AND ORPHANS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\clubpenalty=3000 % adjust for widows and orphans 10000 is max
\widowpenalty=3000 % adjust for widows and orphans 10000 is max
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%PACKAGES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Indexing
\usepackage{makeidx}
\makeindex
%\usepackage{graphics} % Packages to allow inclusion of graphics
\usepackage{graphicx} % Packages to allow inclusion of graphics
\usepackage{pifont}
\usepackage{lettrine}
\usepackage{newcent}
\usepackage{caption}
%\usepackage{setspace}
%\usepackage{subfigure}
%\usepackage{epsfig}
\usepackage{calc,fourier}
%\usepackage{fancyhdr}
\usepackage[T1]{fontenc}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%SETTINGS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\captionsetup{labelformat=empty,labelsep= none,justification= justified,width=.75\textwidth,aboveskip=5pt}
\pdfpagewidth 5.5in
\pdfpageheight 8.5in
\setlength\topmargin{-.75in}
\setlength\headheight{.2in}
\setlength\headsep{.3in}
\setlength\textheight{7.0in}
\setlength\textwidth{4.5in}
\setlength\oddsidemargin{-0.25in}
\setlength\evensidemargin{-0.5in}
\setlength\parindent{0.25in}
\setlength\parskip{0in}
%This part is for the fancy chapter title style
\newcommand\mylleaf{\ding{'247}}
\newcommand\myrleaf{\reflectbox{\mylleaf}}
\newcommand\MyNumToName[1]{%
\ifcase#1\relax % case 0
\or First\or Second\or Third%
\else Not implemented\fi}
\makeatletter
\setlength\midchapskip{10pt}
\makechapterstyle{VZ15b}{
\renewcommand\chapternamenum{}
\renewcommand\printchaptername{}
\renewcommand\chapnamefont{\Large\scshape}
\renewcommand\printchapternum{%
\chapnamefont\null\hfill\mylleaf\quad
\MyNumToName{\thechapter}\space\@chapapp\quad\myrleaf\hfill\null}
\renewcommand\printchapternonum{%
\par\hrule\vskip\midchapskip}
\renewcommand\chaptitlefont{\Huge\scshape\centering}
\renewcommand\afterchapternum{%
\par\nobreak\vskip\midchapskip\hrule\vskip\midchapskip}
\renewcommand\afterchaptertitle{%
\par\vskip\midchapskip\hrule\nobreak\vskip\afterchapskip}
}
\makeatother
%VZ21 style
\usepackage{calc,fourier}
\usepackage[T1]{fontenc}
\makeatletter
\setlength\midchapskip{7pt}
\makechapterstyle{VZ21}{
\renewcommand\chapnamefont{\huge\scshape}
\renewcommand\chapnumfont{\huge\scshape\centering}
\renewcommand\chaptitlefont{\Huge\bfseries\centering}
% \renewcommand\chapnamefont{\Large\scshape}
%\renewcommand\chaptername
% \renewcommand\chapnumfont{\Large\scshape\centering}
% \renewcommand\chaptitlefont{\huge\bfseries\centering}
\renewcommand\printchaptertitle[1]{%
\setlength\tabcolsep{7pt}% used as indentation on both sides
\settowidth\@tempdimc{\chaptitlefont ##1}%
\setlength\@tempdimc{\textwidth-\@tempdimc-2\tabcolsep}%
\chaptitlefont
\ifdim\@tempdimc > 0pt\relax% one line
\begin{tabular}{c}
\toprule ##1\\ \bottomrule
\end{tabular}
\else% two+ lines
\begin{tabular}{%
>{\chaptitlefont\arraybackslash}p{\textwidth-2\tabcolsep}}
\toprule ##1\\ \bottomrule
\end{tabular}
\fi
}
}
\makeatother

\bibliographystyle{alpha}

\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%FRONTMATTER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\frontmatter %memoir frontmatter
\pagestyle{empty}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%HALF-TITLE PAGE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\openright
\vspace*{\fill}
\begin{center}
\HUGE\scshape
HERE'S MY TITLE

Here's my subtitle


\large\scshape
Here's a sub-sub title
\end{center}
\vspace*{\fill}
\cleardoublepage
\pagestyle{empty}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%TITLEPAGE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Title Page
\openright

\title{HERE'S MY TITLE}%\thetitle{HERE'S MY TITLE}

\author{AUTHOR NAME}%\theauthor
\date{ Second Edition - 2008 }%\thedate
\newpage

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%LET'S TRY THIS THE HARD WAY - A DO IT YOURSELF TITLE PAGE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\vspace*{\fill}
\begin{center}
\HUGE\scshape
HERE'S MY TITLE\par

HERE'S MY SUBTITLE\par
\vspace{\stretch{.5}}
\large\scshape
AUTHOR NAME\par
\vspace{\stretch{1}}
\small\scshape
Second Edition - 2008
\end{center}
\vspace*{\fill}
%\pagebreak{}
%\clearpage
\newpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%COPYRIGHT PAGE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% copyright page
\pagestyle{plain}
\setcounter{page}{1}
\pagenumbering{roman}
\begingroup
\footnotesize
\setlength{\parindent}{0pt}
\setlength{\parskip}{\baselineskip}
%%\ttfamily
\textcopyright{} 2008 AUTHOR NAME \\
All rights reserved

PUBLISHER NAME

Printed in the USA

The paper used in this publication may meet the minimum requirements
of the American National Standard for Information
Sciences --- Permanence of Paper for Printed Library Materials,
ANSI Z39.48--1984.

\begin{center}
10 09 08 07 06 05 04 03 02 01\hspace{2em}15 14 13 12 11 10 9
\end{center}
\begin{center}
\begin{tabular}{ll}
Second edition: 2008 \\
\
\end{tabular}
\end{center}
\endgroup
%\end{titlingpage}
\clearpage
%\cleardoublepage
%\newpage
\openright
%\pagenumbering{roman}
%% ToC, etc
%\pagenumbering{roman}
%\pagestyle{headings}
%%%%%\pagestyle{Ruled}

\setcounter{tocdepth}{1}
\tableofcontents*
%\cleardoublepage
%\listoffigures
%\clearpage
%\listoftables
\newpage
%\thispagestyle{empty} %this was an attempt to force a blank page - no good
%\mbox{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%FOREWORD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cleardoublepage
%\pagebreak{}

%\section{Foreword}
%\openright
\begin{center}
FOREWORD
\end{center}
%\thispagestyle{empty}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum vel dui in quam aliquam tincidunt. Nam velit urna, tempus vitae, posuere id, mollis sed, lacus. In dictum aliquam orci. Nulla viverra lacinia purus. Etiam ullamcorper. Pellentesque sem. Nullam sem dui, pharetra eget, tempus a, laoreet vel, mauris. Integer pretium, elit venenatis dapibus ullamcorper, nunc massa molestie nisi, nec viverra velit pede sed sem. Suspendisse et urna non nibh volutpat tempus. Donec mattis fermentum mauris. Cras tempus nulla vel leo. Integer tristique urna vel velit. In non nisi a diam egestas rhoncus. Donec consectetuer, diam vel luctus tempus, eros dolor pharetra risus, ut hendrerit lacus enim fermentum tortor.

Praesent posuere, nulla ut blandit elementum, augue est rhoncus risus, in facilisis tellus dui nec ligula. Suspendisse blandit tellus ut felis vulputate consectetuer. Aenean molestie, elit ut bibendum viverra, quam leo condimentum sapien, eu facilisis augue purus quis diam. Aenean vehicula nisl. Sed nec quam eu tortor tempor condimentum. Quisque turpis dolor, fermentum volutpat, pellentesque in, lacinia eu, turpis. Vestibulum eleifend elit sed metus. Morbi convallis risus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse tristique felis sit amet mauris. Vivamus nec massa et nunc mattis suscipit. Maecenas congue. Mauris accumsan. Vivamus quam felis, viverra ac, euismod sit amet, commodo quis, pede. Sed mattis. Maecenas aliquam mauris adipiscing ante.

%\pagebreak{}
%\include {foreword}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%NOTES ABOUT THE SECOND EDITION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cleardoublepage
%\openright
%\section{Notes About The Second Edition}
\begin{center}
Notes about the Second Edition
\end{center}
%\thispagestyle{empty}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum vel dui in quam aliquam tincidunt. Nam velit urna, tempus vitae, posuere id, mollis sed, lacus. In dictum aliquam orci. Nulla viverra lacinia purus. Etiam ullamcorper. Pellentesque sem. Nullam sem dui, pharetra eget, tempus a, laoreet vel, mauris. Integer pretium, elit venenatis dapibus ullamcorper, nunc massa molestie nisi, nec viverra velit pede sed sem. Suspendisse et urna non nibh volutpat tempus. Donec mattis fermentum mauris. Cras tempus nulla vel leo. Integer tristique urna vel velit. In non nisi a diam egestas rhoncus. Donec consectetuer, diam vel luctus tempus, eros dolor pharetra risus, ut hendrerit lacus enim fermentum tortor.

Praesent posuere, nulla ut blandit elementum, augue est rhoncus risus, in facilisis tellus dui nec ligula. Suspendisse blandit tellus ut felis vulputate consectetuer. Aenean molestie, elit ut bibendum viverra, quam leo condimentum sapien, eu facilisis augue purus quis diam. Aenean vehicula nisl. Sed nec quam eu tortor tempor condimentum. Quisque turpis dolor, fermentum volutpat, pellentesque in, lacinia eu, turpis. Vestibulum eleifend elit sed metus. Morbi convallis risus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse tristique felis sit amet mauris. Vivamus nec massa et nunc mattis suscipit. Maecenas congue. Mauris accumsan. Vivamus quam felis, viverra ac, euismod sit amet, commodo quis, pede. Sed mattis. Maecenas aliquam mauris adipiscing ante.

\clearpage
%\pagebreak{}
%\include {secondeditionnotes}
%\chapter {Preface}
%\keepthetitle
\pagestyle{myheadings}
%\pagestyle{fancy}
%\renewcommand{\chaptermark}[1]{\markright{#1}{}}
%\renewcommand{\titlemark}[1]{\markleft{#1}{}}
%\markboth{\thetitle}{\chaptername}
%\renewcommand{\chaptermark}[2]{%
%\markright{#1}{}
%\markleft{}{#2}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%MAIN MATTER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\mainmatter
\openright
%\aliaspagestyle{chapter}{plain}
%Set the chapter style for headings etc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%CHAPTER 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\include {MemoirChapTest3} %Example of how to add chapters
\chapterstyle{VZ21}
%\pagestyle{headings}
%\pagestyle{myheadings}
%\openright
\setcounter{page}{1}
%\centering
%\chapterheadstart
%\printchaptername \chapternamenum \printchapternum
%\afterchapternum[1]
%\printchaptertitle{MY CHAPTER 1}
%\afterchaptertitle
%\chapter {MY CHAPTER 1}
\chapter[MY CHAPTER 1] [MY CHAPTER 1] {MY CHAPTER 1}
\markboth{\thetitle}{MY CHAPTER 1}
Praesent posuere, nulla ut blandit elementum, augue est rhoncus risus, in facilisis tellus dui nec ligula. Suspendisse blandit tellus ut felis vulputate consectetuer. Aenean molestie, elit ut bibendum viverra, quam leo condimentum sapien, eu facilisis augue purus quis diam. Aenean vehicula nisl. Sed nec quam eu tortor tempor condimentum. Quisque turpis dolor, fermentum volutpat, pellentesque in, lacinia eu, turpis. Vestibulum eleifend elit sed metus. Morbi convallis risus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse tristique felis sit amet mauris. Vivamus nec massa et nunc mattis suscipit. Maecenas congue. Mauris accumsan. Vivamus quam felis, viverra ac, euismod sit amet,
%\printindex
\end{document}
Last edited by Klopstick on Sat Jun 14, 2008 3:50 am, edited 1 time in total.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Re: Memoir \markboth or \openright?

Post by Stefan Kottwitz »

Hi Klopstick,

your example is not compilable, the preamble is missing. So we cannot really speak about the same code.
After I completed your code to make it compilable I got the first chapter starting at an odd-numbered page (1), a recto page, so the example code does not show the problem.

Stefan
LaTeX.org admin
Klopstick
Posts: 16
Joined: Sat Jan 27, 2007 11:18 pm

Re: Memoir \markboth or \openright?

Post by Klopstick »

Hi Again Stefan,

OK, I added the preamble to the code above, maybe that will give you an idea. My TOC had 16 chapters in it, if that makes any difference.

Ideally, I'd like the Forword and the Notes on Second Edition pages to also be on the recto page with blank verso, then chap 1 on recto, as normal. When I compiled this just now, I got the chapter starting on page 10 (verso).

Thanks for all your help, you're a saint! I'll get the hang of this eventually, but it hasn't quite clicked yet.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Re: Memoir \markboth or \openright?

Post by Stefan Kottwitz »

Hi Klopstick,

now the code is compilable, very good, so there should be no misunderstanding because of different code.

Although the chapter is starting at the 10th page of the pdf file it is numbered as page 1. The pages before have different numbering, none or roman. Page 1 is an odd-numbered page, so its right-handed and recto, that's what you intended.
The position in the pdf (#10) isn't important, but the number on the page itself is. That will appear in the print.

Stefan
LaTeX.org admin
Klopstick
Posts: 16
Joined: Sat Jan 27, 2007 11:18 pm

Memoir \markboth or \openright?

Post by Klopstick »

Thanks for the quick reply Stefan,

I see what you are saying about the numbering, but I'm not sure I understand quite how that would work. I'll be sending the PDF to the printer, so my assumption is that it will be printed and bound exactly as it comes to them.

When I actually print the proof sheets (both sides of the page, one book page per side) here's what I see:

Half-title (recto)
(verso is blank)
Title (recto)
(verso is blank)
Contents (recto)
Foreword (verso) - [I'd prefer this to be on the next recto, actually]
The next recto is blank!
Notes about the Seond edition (verso)
The next recto is blank!
Chapter 1 (verso)

So from what I'm seeing, I need to insert a blank page right after the contents page to get everything to print in the correct order. Could you please clarify on this? Sorry if I'm being dense.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Memoir \markboth or \openright?

Post by Stefan Kottwitz »

Hi Klopstick,

yes, you could insert a page after (or before) your toc. The number of the starting page of the first chapter will not change by that because of \setcounter{page}{1} right before that chapter. This manual setting of the counter allows you to vary before like you want.
In the example of you that I've tested the toc appeared on page II, that's an even-numbered (verso) page, probably it should be odd-numbered (recto). The memoir class is only testing the page counter. Here are some line of its source:

Code: Select all

\newcommand{\openright}{\@openrighttrue\@openleftfalse%
  \gdef\clearforchapter{\cleartorecto}}
...
\def\cleartorecto{\clearpage\if@twoside \ifodd\c@page\else
  \hbox{}\thispagestyle{cleared}%
  \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
memoir will ensure that the chapters start on odd-numbered pages. You would have to ensure that the odd-numbered pages appear right-hand in print.

Stefan
LaTeX.org admin
Post Reply