Search code examples
markdownr-markdownpandocbookdown

How to have correct page numbering with twoside=false in PDF (produced from bookdown)?


I have simple bookdown document:

---
title: Page number problem
documentclass: book

site: bookdown::bookdown_site
output:
  bookdown::pdf_book: default

papersize: a4
geometry: 'left=0.8in, right=0.4in, top=0.5in, bottom=1in, twoside=false'

header-includes:
- \usepackage[fontsize=14pt]{scrextend}
- \pagestyle{plain}

---

# Header 1

Some text on page 2 

\newpage

# Header 2

Some text on page 3

I expect the following page numbering:

  1. title (not numbered)
  2. contents (numbered)
  3. chapter 1 (numbered)
  4. chapter 2 (numbered)

but got two No 1 pages:

page numbering

What am I doing wrong or missed?


Solution

  • This is standard behavior of the LaTeX book and report classes, though I cannot point you to the relevant documentation right now. For onside documents the titlepage is treated like an un-numbered cover page. If you want to start the actual page numbering at 2, you can add \stepcounter{page} before the TOC. One way to achieve this would be to add

    include-before:
    - \stepcounter{page}
    

    to your YAML header.