Introduction to Quarto

Gabriel J. Odom, PhD, ThD

https://gabriel.quarto.pub/introduction-to-quarto

2022-10-21

Outline

  • What is Quarto?
  • Basic Document Components
  • Examples (and Participation!)
  • Wrapping Up

Slide materials drawn heavily from Prof. Andrew Bray’s From RMarkdown to Quarto workshop at RStudio 2022. Also see the blog posts from Alison Hill and Nick Tierney.

Getting Started

R Users

Update to the newest version of RStudio, and you get Quarto automatically!


Python/Julia Users

Follow the Get Started steps to download and enable Quarto in VS Code or use directly via the command line. Save any Quarto files with the extension .qmd.

What is Quarto?

Quarto

“Quarto is an open-source scientific and technical publishing system built on Pandoc.” - RStudio, 2022

Quarto enables you to weave together content and executable R, Python, or Julia code into a finished presentation.

  • If you’ve used RMarkdown before, Quarto is often termed “RMarkdown 2.0”
  • If you use Jupyter Notebooks, Quarto functions very similarly (and can even compile .ipynb notebooks!)

The Quarto Document Conversion Workflow

Quarto Document Types

  • Articles (HTML, Word, PDF)
  • Presentations—like this one (HTML, PowerPoint, Beamer/LaTeX)
  • Websites
  • Books

Basic Document Components

Three (Main) Quarto Document Components

  • YAML metadata (aka “frontmatter”)
  • Text and commentary, “marked up” (formatted) in Markdown syntax
  • Code and its output

YAML Frontmatter

  • At the beginning of each document, you need YAML meta-data to tell Quarto what to do with the document.
  • YAML headers are “fenced” (contained) by leading and trailing ---
  • All YAML options use key: value pairs
  • Nest key-value pairs by indenting two spaces
  • WHITESPACE MATTERS!!! (use spaces, and never tabs)
  • Create a list of values with -
  • Include a multi-line value by starting with |

YAML Examples

Figure 1: Example YAML frontmatter for one of our recent articles

YAML Examples

Figure 2: Example YAML frontmatter for the corresponding presentation

Markdown Text

  • Markdown is a lightweight text formatting language.
  • Markdown can be used to:
    • “mark-up” or adorn fonts
    • organize text into sections with headings
    • include images and hyperlinks
    • create ordered, numbered, unordered, and interrupted lists

Code

Typing a code chunk …


… gives you this:

1 + 1
[1] 2

Dissecting a Code Chunk

Examples (and Participation)

Creating a Basic Quarto Document

  • Let’s go to RStudio…

Wrapping Up

Review

  • We learned about Quarto’s connection between multiple languages and multiple document types
  • We learned some basic Quarto syntax
  • We rendered our very first Quarto report