Search code examples
rxaringan

xaringan: Easy way to change aspect ratio?


I would like to change the aspect ratio of a xaringan presentation to 16:9. I guess it would be possible if I would create a custom css theme. However, this would be somewhat of an overkill for me.

So, is there any really simple way of doing that?


Solution

  • That is super easy since it is already implemented. Just include the following in the YAML (in addition to all the other stuff in your YAML):

    output:
      xaringan::moon_reader:
        nature:
          ratio: '16:9'
    

    Here's my default start YAML. Maybe you can tweak that to your desires.

    ---
    title: "My title"
    author: "Claus<br>UCPH Biostatistics<br>.small[[email protected] ]"
    date: 'Some day 2019'
    output:
      xaringan::moon_reader:
        lib_dir: libs
        css: ['default', 'hygge']
        seal: true
        nature:
          ratio: '16:9'
          slideNumberFormat: '%current%' 
          highlightStyle: ir-black
          highlightLines: true
          countIncrementalSlides: false
    ---