Chapter 6 Installing and Configuring Quarto

Quarto is a scientific publishing system that allows you to create beautiful documents, presentations, and websites that combine code, text, and visualizations.

What you’ll accomplish:

  • ✅ Install Quarto CLI (command-line interface)
  • ✅ Configure Quarto in RStudio
  • ✅ Configure Quarto in VSCode
  • ✅ Create and render your first Quarto document

6.1 What is Quarto?

Think of Quarto as a tool that lets you write living documents where:

  • 📝 Text explains your analysis
  • 💻 Code performs calculations
  • 📊 Results (tables, plots) appear automatically
  • 🎨 Everything looks professional and polished

Quarto vs R Markdown:

If you’ve heard of R Markdown (.Rmd files), Quarto is its modern successor! Quarto:

  • ✅ Works with R, Python, Julia, and more
  • ✅ Has better syntax and features
  • ✅ Creates more output types (websites, books, presentations)
  • ✅ Is actively developed by Posit (the RStudio company)

For this course, we’ll use Quarto exclusively.

6.2 Step 1: Download Quarto

Go to the Quarto download page:

https://quarto.org/docs/get-started/

Click the download button for your operating system:

  • Windows: quarto-*-win.msi
  • macOS: quarto-*-macos.pkg
  • Linux: .deb or .tar.gz depending on your distribution

6.3 Step 2: Install Quarto

6.3.1 Windows Installation

  1. Locate the downloaded .msi file
  2. Double-click to launch the installer
  3. Click “Next” through the setup wizard
  4. Installation folder: Keep default (C:\Program Files\Quarto)
  5. Click “Install”
  6. Wait for installation (~1 minute)
  7. Click “Finish”

6.3.2 macOS Installation

  1. Locate the downloaded .pkg file
  2. Double-click to launch the installer
  3. Click “Continue” through introduction
  4. Agree to the license
  5. Click “Install”
  6. Enter your Mac password when prompted
  7. Click “Close”

6.3.3 Linux Installation (Ubuntu/Debian)

Download the .deb file, then run:

sudo dpkg -i ~/Downloads/quarto-*-linux-amd64.deb

For other distributions, see: https://quarto.org/docs/get-started/

6.4 Step 3: Verify Quarto Installation

Let’s confirm Quarto is installed correctly.

6.4.1 Verify in Terminal/Command Prompt

Open a terminal (macOS/Linux) or Command Prompt (Windows) and type:

quarto --version

You should see something like: 1.5.57 (version number may vary)

Command not found?

  • Restart your computer to update PATH variables
  • Windows: Make sure you chose “Add to PATH” during installation
  • macOS/Linux: Quarto should be automatically available at /usr/local/bin/quarto

If still not working, reinstall Quarto and ensure “Add to PATH” is selected.

6.5 Step 4: Configure Quarto in RStudio

RStudio has excellent built-in support for Quarto!

6.5.1 4.1 Check Quarto is Detected

  1. Open RStudio
  2. Click Tools → Global Options → Quarto

You should see the Quarto version detected:

Path shown:

RStudio should show the path to Quarto, like: - Windows: C:\Program Files\Quarto\bin\quarto.exe - macOS: /usr/local/bin/quarto

6.5.2 4.2 Create Your First Quarto Document in RStudio

  1. Click File → New File → Quarto Document…

  2. In the dialog:

    • Title: “My First Quarto Document”
    • Author: Your name
    • Format: HTML (default)
    • Engine: Knitr (default)
  3. Click “Create”

You’ll see a template .qmd file with example content:

6.5.3 4.3 Render the Document

  1. Click the “Render” button at the top of the editor (or press Ctrl+Shift+K / ⌘+Shift+K)

  2. RStudio will:

    • Run the R code in the document
    • Create plots and tables
    • Generate an HTML file
    • Open the result in the Viewer pane

First render taking a while?

The first time you render a Quarto document, RStudio may need to install additional packages. This is normal and only happens once!

6.5.4 4.4 Explore the Quarto Document Structure

Take a look at the .qmd file you just created. It has three main parts:

6.5.4.1 YAML Header (at the top)

---
title: "My First Quarto Document"
author: "Your Name"
format: html
---

This controls document settings (title, output format, etc.).

6.5.4.2 Markdown Text

## Quarto

Quarto enables you to weave together content and executable code...

Regular text uses Markdown syntax for formatting.

6.5.4.3 Code Chunks

```{{r}}
1 + 1
```

R code goes inside ```{r} blocks and runs when you render.

Quarto Cheat Sheet:

Quarto has a helpful cheat sheet! Download it from:

https://rstudio.github.io/cheatsheets/quarto.pdf

Keep it handy when writing documents!

6.6 Step 5: Configure Quarto in VSCode

VSCode also has excellent Quarto support through the extension you installed in Chapter 3.

6.6.1 5.1 Verify Quarto Extension is Installed

  1. Open VSCode
  2. Click the Extensions icon (four squares) or press Ctrl+Shift+X / ⌘+Shift+X
  3. Search for “Quarto”
  4. You should see “Quarto” by Quarto.org marked as “Installed”

Extension not installed?

Go back to Chapter 3, Step 4.3 to install it!

6.6.2 5.2 Create Your First Quarto Document in VSCode

  1. Click File → New File or press Ctrl+N / ⌘+N

  2. Click “Select a language” at the bottom

  3. Type “Quarto” and select it

  4. Paste this template content:

---
title: "My First Quarto Document in VSCode"
author: "Your Name"
format: html
---

## Introduction

This is a Quarto document created in VSCode!

## R Code Example

```{{r}}
# Simple calculation
x <- 5
y <- 10
result <- x + y
print(paste("The sum is:", result))
```

## Plot Example

```{{r}}
# Load ggplot2
library(ggplot2)

# Create a simple plot
ggplot(mtcars, aes(x = wt, y = mpg)) +
  geom_point() +
  labs(title = "Car Weight vs MPG",
       x = "Weight (1000 lbs)",
       y = "Miles per Gallon") +
  theme_minimal()
```

## Conclusion

Quarto makes it easy to combine code, text, and visualizations!
  1. Save the file: File → Save As → Name it test_vscode.qmd

6.6.3 5.3 Render the Document in VSCode

There are three ways to render a Quarto document in VSCode:

6.6.3.1 Method 1: Preview Button (Easiest)

Click the “Preview” button in the top-right corner of the editor.

6.6.3.2 Method 2: Command Palette

  1. Press Ctrl+Shift+P (Windows/Linux) or ⌘+Shift+P (macOS)
  2. Type: “Quarto: Render”
  3. Press Enter

6.6.3.3 Method 3: Terminal

  1. Open the Terminal in VSCode: Ctrl+`` (backtick) orView → Terminal`
  2. Type:
quarto render test_vscode.qmd

6.6.4 5.4 View the Rendered Output

After rendering, VSCode will:

  • Generate an test_vscode.html file in the same folder
  • Open a preview pane showing the rendered document

Live Preview:

The Quarto extension offers live preview — as you type, the preview updates automatically! Toggle it on/off with the “Preview” button.

6.7 Step 6: Quarto Output Formats

Quarto can render to multiple formats! Try these:

6.7.1 PDF Output (requires LaTeX)

Change the YAML header:

---
title: "My Document"
format: pdf
---

PDF rendering requires LaTeX:

If you don’t have LaTeX installed, Quarto can install TinyTeX (a lightweight LaTeX distribution) for you:

In R Console or Terminal:

quarto install tinytex

This takes ~5-10 minutes but only needs to be done once.

6.7.2 Word Document Output

---
title: "My Document"
format: docx
---

6.7.3 RevealJS Presentation Slides

---
title: "My Presentation"
format: revealjs
---

6.7.4 Multiple Formats at Once

---
title: "My Document"
format:
  html:
    toc: true
  pdf:
    documentclass: article
  docx: default
---

Render all formats with:

quarto render your-document.qmd

6.8 Video Tutorial: Getting Started with Quarto

Video not loading?

Watch on YouTube: Getting Started with Quarto

6.9 Summary Checklist

Before moving to the next chapter, make sure you have:

Troubleshooting:

Render fails with “R not found”: - Make sure R is installed (see Chapter 4) - Restart RStudio or VSCode

Plots don’t appear: - Make sure required packages are installed (install.packages("ggplot2")) - Check that your code chunk has {r} and not just {}

Still stuck? Reach out via email or office hours!


Next: Chapter 6: Setting Up GitHub Copilot