[PR #1895] [MERGED] Refine PDF layout for front matter pages and Chapter 1 #32166

Closed
opened 2026-07-12 08:50:12 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/harvard-edge/cs249r_book/pull/1895
Author: @hzeljko
Created: 6/24/2026
Status: ✅ Merged
Merged: 6/25/2026
Merged by: @profvjreddi

Base: dev ← Head: vol1/frontmater-final


📝 Commits (1)

  • 372f142 Refine front matter and Chapter 1 introduction layout

📊 Changes

4 files changed (+55 additions, -28 deletions)

View changed files

📝 book/quarto/_extensions/mlsysbook-ext/titlepage/before-body.tex (+1 -1)
📝 book/quarto/contents/vol1/introduction/introduction.qmd (+13 -12)
📝 book/quarto/tex/frontmatter-vol1.tex (+2 -1)
📝 book/quarto/tex/header-includes.tex (+39 -14)

📄 Description

Summary of the first commit

This commit updates the Volume I front-matter and main-matter page sequence to match the MIT Press publisher requirements.

The page order has been adjusted as follows:

  • half-title page — p. i
  • blank page — p. ii
  • full title page — p. iii
  • copyright page — p. iv
  • dedication page — p. v
  • blank page — p. vi
  • Table of Contents starts on p. vii
  • Welcome page starts on p. xv
  • the remaining front-matter pages continue with Roman page numbering
  • Main Matter division page starts with Arabic numbering on p. 1
  • blank page — p. 2
  • Chapter 1 starts on p. 3
  • the remaining chapters continue with Arabic page numbering

The following files were updated to support this layout.

quarto/_extensions/mlsysbook-ext/titlepage/before-body.tex

The command

\setcounter{page}{1}

was disabled to prevent the page counter from being reset before the Table of Contents.

quarto/tex/frontmatter-vol1.tex

The command

\addtocounter{page}{-1}

was added inside

\renewcommand{\halftitle}{...}

so that the half-title page starts correctly on page i.

The final \clearpage at the end of the dedication page was also changed to \cleardoublepage in order to insert the required blank page before the Table of Contents and ensure that the Table of Contents starts on an odd-numbered page, p. vii.

quarto/tex/header-includes.tex

The command

\newcommand{\unnumbered@chapter}[1]{...}

was adjusted so that the first unnumbered chapter after the Table of Contents, the Welcome chapter, starts on p. xv.

The command

\setcounter{lastRomanPage}{\value{page}}

was disabled because it is no longer needed. When

\pagenumbering{roman}

is used, LaTeX automatically resets the page counter to 1.

The command

\setcounter{page}{15}

was added so that the Welcome chapter starts on Roman page xv. Since the Table of Contents starts on p. vii and occupies seven pages, it ends on p. xiv, so the next page should correctly be p. xv.

The same logic was also applied to

\newcommand{\numbered@chapter}[1]{...}

because

\pagenumbering{arabic}

automatically resets the page counter to 1.

The Main Matter division page needs to start on a right-hand page, so the page break inside

\newcommand{\division}[1]{...}

was changed from \clearpage to \cleardoublepage:

\newcommand{\division}[1]{%
  \FloatBarrier% Flush all pending floats before division break
  \cleardoublepage

The Main Matter page is also the first page that should use Arabic page numbering. For this reason, I added a conditional flag so that the first call to \division switches the document to Arabic numbering by using:

\pagenumbering{arabic}

Since \pagenumbering{arabic} automatically resets the page counter, this makes the Main Matter division page start as page 1.

On subsequent calls to \division, for example for later division pages, the condition is no longer true, so the Arabic page numbering simply continues without being reset.

\makeatletter
\newif\if@firstdivision
\@firstdivisiontrue

% DIVISIONS: Clean geometric styling with subtle tech elements
% Used for frontmatter, main_content, and backmatter divisions
\newcommand{\division}[1]{%
  \FloatBarrier% Flush all pending floats before division break
  \cleardoublepage
  %
  \if@firstdivision
    \pagenumbering{arabic}% starts Arabic numbering from 1
    \@firstdivisionfalse
  \fi
  %

Finally, inside

\newcommand{\numberedpart}[1]{...}

the command

\pagenumbering{arabic}

was disabled for the first numbered part. This prevents the page counter from being reset when Part I starts. The Arabic page numbering should begin with the Main Matter division page and then continue through Part I and the following chapters without being restarted.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/harvard-edge/cs249r_book/pull/1895 **Author:** [@hzeljko](https://github.com/hzeljko) **Created:** 6/24/2026 **Status:** ✅ Merged **Merged:** 6/25/2026 **Merged by:** [@profvjreddi](https://github.com/profvjreddi) **Base:** `dev` ← **Head:** `vol1/frontmater-final` --- ### 📝 Commits (1) - [`372f142`](https://github.com/harvard-edge/cs249r_book/commit/372f14221b97446320a5eff134e74b96d6a1f0cf) Refine front matter and Chapter 1 introduction layout ### 📊 Changes **4 files changed** (+55 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `book/quarto/_extensions/mlsysbook-ext/titlepage/before-body.tex` (+1 -1) 📝 `book/quarto/contents/vol1/introduction/introduction.qmd` (+13 -12) 📝 `book/quarto/tex/frontmatter-vol1.tex` (+2 -1) 📝 `book/quarto/tex/header-includes.tex` (+39 -14) </details> ### 📄 Description ### Summary of the first commit This commit updates the Volume I front-matter and main-matter page sequence to match the MIT Press publisher requirements. The page order has been adjusted as follows: * half-title page — p. i * blank page — p. ii * full title page — p. iii * copyright page — p. iv * dedication page — p. v * blank page — p. vi * Table of Contents starts on p. vii * Welcome page starts on p. xv * the remaining front-matter pages continue with Roman page numbering * Main Matter division page starts with Arabic numbering on p. 1 * blank page — p. 2 * Chapter 1 starts on p. 3 * the remaining chapters continue with Arabic page numbering The following files were updated to support this layout. #### `quarto/_extensions/mlsysbook-ext/titlepage/before-body.tex` The command ```tex \setcounter{page}{1} ``` was disabled to prevent the page counter from being reset before the Table of Contents. #### `quarto/tex/frontmatter-vol1.tex` The command ```tex \addtocounter{page}{-1} ``` was added inside ```tex \renewcommand{\halftitle}{...} ``` so that the half-title page starts correctly on page i. The final `\clearpage` at the end of the dedication page was also changed to `\cleardoublepage` in order to insert the required blank page before the Table of Contents and ensure that the Table of Contents starts on an odd-numbered page, p. vii. #### `quarto/tex/header-includes.tex` The command ```tex \newcommand{\unnumbered@chapter}[1]{...} ``` was adjusted so that the first unnumbered chapter after the Table of Contents, the Welcome chapter, starts on p. xv. The command ```tex \setcounter{lastRomanPage}{\value{page}} ``` was disabled because it is no longer needed. When ```tex \pagenumbering{roman} ``` is used, LaTeX automatically resets the page counter to 1. The command ```tex \setcounter{page}{15} ``` was added so that the Welcome chapter starts on Roman page xv. Since the Table of Contents starts on p. vii and occupies seven pages, it ends on p. xiv, so the next page should correctly be p. xv. The same logic was also applied to ```tex \newcommand{\numbered@chapter}[1]{...} ``` because ```tex \pagenumbering{arabic} ``` automatically resets the page counter to 1. The Main Matter division page needs to start on a right-hand page, so the page break inside ```tex \newcommand{\division}[1]{...} ``` was changed from `\clearpage` to `\cleardoublepage`: ```tex \newcommand{\division}[1]{% \FloatBarrier% Flush all pending floats before division break \cleardoublepage ``` The Main Matter page is also the first page that should use Arabic page numbering. For this reason, I added a conditional flag so that the first call to `\division` switches the document to Arabic numbering by using: ```tex \pagenumbering{arabic} ``` Since `\pagenumbering{arabic}` automatically resets the page counter, this makes the Main Matter division page start as page 1. On subsequent calls to `\division`, for example for later division pages, the condition is no longer true, so the Arabic page numbering simply continues without being reset. ```tex \makeatletter \newif\if@firstdivision \@firstdivisiontrue % DIVISIONS: Clean geometric styling with subtle tech elements % Used for frontmatter, main_content, and backmatter divisions \newcommand{\division}[1]{% \FloatBarrier% Flush all pending floats before division break \cleardoublepage % \if@firstdivision \pagenumbering{arabic}% starts Arabic numbering from 1 \@firstdivisionfalse \fi % ``` Finally, inside ```tex \newcommand{\numberedpart}[1]{...} ``` the command ```tex \pagenumbering{arabic} ``` was disabled for the first numbered part. This prevents the page counter from being reset when Part I starts. The Arabic page numbering should begin with the Main Matter division page and then continue through Part I and the following chapters without being restarted. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-07-12 08:50:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cs249r_book#32166