1

The sample code at the bottom of this post results in the following page order:

  1. title page
  2. metadata page
  3. table of contents
  4. blank page (seems to be continued from the table of contents)
  5. chapter

I'm really scratching my head about why the blank page (4) shows up. As best I can tell, it seems to be related to a \vspace*{\fill} command I placed on page (2). But this is confusing to me. Doesn't that come before the table of contents?

I want to keep the \vspace*{\fill} because (in the actual book I'm typesetting) I'm using it to vertically center the content on the metadata page.

What's going on?

\documentclass[12pt, oneside]{book}

%%%%%%%% % Headers and footers. \usepackage{fancyhdr} \pagestyle{fancy}

\fancyhead[LE,RO]{\thepage} \fancyhead[LO,RE]{\textit{\nouppercase{\leftmark}}} \fancyfoot[C]{}

\renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt}

\title{Sample title} \author{Sample author} \date{Sample date}

\begin{document} \frontmatter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Title page.

\begin{titlepage}

Sample title page.

\end{titlepage}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Metadata page.

\thispagestyle{empty}

\topskip0pt \vspace*{\fill}

Sample metadata page.

\vspace*{\fill}

{ \setcounter{tocdepth}{0} \tableofcontents }

\mainmatter

\chapter{Sample chapter title}

Sample chapter text.

\end{document}

2 Answers2

1

Sorry to be late to the party. Setting \topskip mid-document is the cause of the problem.

If you really want to “precisely center” the metadata, issue \mbox{} and a negative space by \topskip. But I don't think it's necessary or even good for the purpose.

\documentclass[12pt, oneside]{book}

%%%%%%%% % Headers and footers. \usepackage{fancyhdr} \pagestyle{fancy}

\fancyhead[LE,RO]{\thepage} \fancyhead[LO,RE]{\textit{\nouppercase{\leftmark}}} \fancyfoot[C]{}

\renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt}

\title{Sample title} \author{Sample author} \date{Sample date}

\begin{document} \frontmatter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Title page.

\begin{titlepage}

Sample title page.

\end{titlepage}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Metadata page.

\thispagestyle{empty}

\mbox{}

\vspace{-\topskip} \vspace{\fill}

Sample metadata page.

\vspace*{\fill}

\setcounter{tocdepth}{0} \tableofcontents

\mainmatter

\chapter{Sample chapter title}

Sample chapter text.

\end{document}

This will have four pages.

By the way, adding braces around \setcounter{tocdepth}{0} doesn't localize the setting, because \setcounter has global scope. Setting LE,RO or LO,RE with oneside only produces annoying warnings, because with oneside the parity of page numbers is not examined when the header or footer is produced.

egreg
  • 1,121,712
0

It seems that the \mainmatter command moves to the next odd page when you are using the oneside class option.

Try this modified version of your MWE, for which thank you.

% chapterprob.tex  SE 577746

\documentclass[12pt, oneside]{book} %\documentclass[12pt]{book}

%%%%%%%% % Headers and footers. \usepackage{fancyhdr} \pagestyle{fancy}

\fancyhead[LE,RO]{\thepage} \fancyhead[LO,RE]{\textit{\nouppercase{\leftmark}}} \fancyfoot[C]{}

\renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt}

\title{Sample title} \author{Sample author} \date{Sample date}

\begin{document} %\frontmatter \pagenumbering{roman}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Title page.

\begin{titlepage}

Sample title page.

\end{titlepage}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Metadata page.

\thispagestyle{empty}

\topskip0pt \vspace*{\fill}

Sample metadata page.

\vspace*{\fill}

{ \setcounter{tocdepth}{0} \tableofcontents }

%\mainmatter %\pagenumbering{arabic}

\chapter{Sample chapter title} \pagenumbering{arabic}

Sample chapter text.

\end{document}

Note that instead of \frontmatter and \mainmatter I have used \pagenumbering to change the representation of the page numbers (which is one of the things that the \...matter macros do).

Peter Wilson
  • 28,066
  • \mainmatter does contain a \cleardoublepage, so this is one way to work around it. Per the other comments though this seems to be a bad interaction with setting \topskip without using braces to properly scope it. (I still don't understand why, but it seems like the best explanation at this point.) – Elliott Slaughter Jan 07 '21 at 00:12