Search code examples
latexknitrbookdown

How can I remove blank pages from rbookdown pdfs?


I am using the default Bookdown example "A Minimal Book Example" which is available on GitHub: https://github.com/rstudio/bookdown-demo

How do I edit the template so that the PDF output does not have blank pages before all the chapters?

I don't speak TeX so basic clues for the clueless would be greatly appreciated.


Solution

  • This is not a problem with rbookdown itself, but it is because of a classoption in the documentclass "book" in LaTex. I found the hint here.

    At the top of you index.Rmd file, you have documentclass: book in your YAML header. Right below it, add classoption: openany to fix this. For example:

    --- 
    title: "Fancy Title"
    author: "Your Name"
    date: "`r Sys.Date()`"
    documentclass: book
    classoption: openany
    ---