Search code examples
rlatexr-markdownmarkdownbeamer

R markdown beamer presentation: adjust the width/aspect ratio of slides


How to adjust the width of the slides of an R markdown presentation rendered as output format beamer to generate a LaTex/PDF file? To be able to quickly adjust to a given presentation device (widescreen, 4:3 screen, ...), the aspect ratio could ideally be altered easily to take different values.

MWE:

---
title: "Adjust the width/aspect ratio of slides"
output:
  # beamer_presentation: default
  bookdown::pdf_book:
    base_format: rmarkdown::beamer_presentation
---


## Some Slides

some content

Solution

  • You can pass the aspectratio as class option. Have a look at the beamer user guide to check the available ratios.

    ---
    title: "Adjust the width/aspect ratio of slides"
    output:
      beamer_presentation:
        theme: "default"
        keep_tex: true
    classoption: aspectratio=169    
    ---
    
    ## Some Slides
    
    some content