Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting paper size for PDF output in bookdown with tufte-book

Tags:

r

bookdown

In _output.yml, the following actually sets the paper size correctly:

bookdown::pdf_book:   
  pandoc_args: [    
   "-V", "papersize=a4"    
  ]

But when I want to use tufte_book, the papersize argument has no effect, and the output in in letter size no matter what:

bookdown::pdf_book:
  base_format: tufte::tufte_book
  pandoc_args: [
   "-V", "papersize=a4"
   ] 

How do I override the default paper size in tufte_book?

like image 825
Michel Baudin Avatar asked Jun 08 '18 13:06

Michel Baudin


1 Answers

You have to specify this as

bookdown::pdf_book:
  base_format: tufte::tufte_book
  pandoc_args: [
   "-V", "papersize=a4paper"
   ] 

I found this only by looking at the resulting .tex file. The reason is in the used templates. The Tufte templte includes $if(papersize)$$papersize$,$endif$ in the options to the document class, while the default template uses $if(papersize)$$papersize$paper,$endif$ with a literal paper.

BTW, you can also defines this in index.Rmd as

---
[...]
papersize: a4paper
---
like image 138
Ralf Stubner Avatar answered Oct 12 '22 23:10

Ralf Stubner