Search code examples
pdflatexquarto

Add blank page after certain page in pdf Quarto


I would like to add a blank page after certain page in pdf Quarto. I tried using \newpage like described here with this reproducible example:

---
title: "Add blank page after certain page"
format: pdf
---

# Chapter 1

Here some random text

\newpage

\newpage

# Chapter 2

Again random rext after white page

Output:

enter image description here

As you can see in the output, there is no blank page after the first page. I also tried \pagebreak like here, but that also doesn't work. So I was wondering if anyone knows how to add a blank page between two chapters in pdf Quarto?


Solution

  • To add blank pages between chapters accounting for page numbers, we can follow this answer,

    ---
    title: "Add blank page after certain page"
    format:
      pdf:
        include-in-header:
          - text: |
              \usepackage{afterpage}
              \def\blankpage{%
              \clearpage%
              \thispagestyle{empty}%
              \addtocounter{page}{-1}%
              \null%
              \clearpage}
    ---
    
    # Chapter 1
    
    Here some random text
    
    \blankpage
    
    # Chapter 2
    
    Again random rext after white page
    

    blank pages between chapters