Reproducible slides with Quarto and continuous deployment via GitHub actions

Demonstration slides

Your name

xyz

2024-10-10

Introduction

Why make a presentation with Quarto and continuous deployment?

  • Allows you to test ideas in a standalone environment
  • Sharing materials with collaborators and the audience
  • Continuous deployment automates the process of updating the slides and ensures reproducibility

How to get started?

  • Check out the Quarto documentation
  • You can use this repository as a template for your own slides, go to https://github.com/Robinlovelace/reproducible-slides-repo-template and clone it
  • Note: the approach here is to publish the slides as part of a Quarto website project so it can be used for other purposes too, e.g. if you want to write a paper building on the slides

Extensions

Add extensions with the following code (which adds the clean-revealjs extension, for example, which has a detailed demo hosted at github.com/grantmcdermott/quarto-revealjs-clean-demo):

quarto install extension grantmcdermott/quarto-revealjs-clean

Then replace:

format: 
  revealjs: default

with:

format: 
  clean-revealjs:
    self-contained: true

In the YAML header of your .qmd file.

Publishing slides (and more)

Setting-up gh-pages branch

You can do this with a single quarto command:

quarto publish gh-pages

Which leads to the following text and eventually auto-opens the deployed webiste!

The website

The previous command creates a gh-pages branch with the slides in the docs folder. This is then automatically deployed to GitHub Pages, and the website is opened in your browser when ready:

How awesome is that?

🤯🤯🤯

Debugging

Source of quarto publish gh-pages hint: Error message from GitHub Actions when trying to publish slides to GitHub Pages:

ERROR: Unable to publish to GitHub Pages (the remote origin does not have a branch named "gh-pages". Use first `quarto publish gh-pages` locally to initialize the remote repository for publishing.)

Adding citations

With the Quarto extension

  • You need to be in Visual Editor mode (Ctrl+Shift+F4)
  • Then it’s Ctrl+Shift+F8

Creates citations like this: (Peng 2011)

With “Citation Picker for Zotero” extension

  • Issue with this approach: doesn’t generate the .bib file

Alt+Shift+Z

References

Peng, Roger D. 2011. “Reproducible Research in Computational Science.” Science (New York, N.y.) 334 (6060): 1226–27. https://doi.org/10.1126/science.1213847.