04:00
Be kind and curious!
Slack and Zoom chat
Ask questions
Time | Activity |
---|---|
10:30–11:30 | Welcome + Intro to Quarto |
11:30–12:30 | Creating basic websites |
12:30–13:30 | Break |
13:00–15:00 | Advanced website features |
Time | Activity |
---|---|
10:30–11:00 | Publishing |
11:00–12:30 | Customization and branding |
12:30–13:30 | Break |
13:00–15:00 | Interactivity |
Andrew Heiss
Assistant professor of public policy, Georgia State University
Data visualization, statistics, and causal inference
This course is designed for someone who:
Knows some R or Python
Maybe has an idea for a website
Is relatively new to Quarto
Wants to customize Quarto output
You’ll learn:
What Quarto is and how to use it
How to create and publish websites with Quarto
How to customize Quarto output
My turn
Your turn
Use Zoom reactions
=
“I’m stuck and need help!”
=
“I finished the exercise”
Ask longer, more detailed questions in Slack
Introduce yourself:
04:00
Quarto is an…
open-source
scientific and technical
publishing system
built on Pandoc.
…you can weave together narrative and code to produce elegantly formatted output such as documents, web pages, blog posts, books, dashboards, and more.
2024 Idaho election results, by Gabe Osterhout and Andrew Heiss
Council Housing & Neighborhood Income Inequality in Vienna by Tamara Premrov and Matthias Schnetzer (European Centre for Social Welfare Policy and Research, Austria)
Navigating Hostility: The Effect of Nonprofit Transparency and Accountability on Donor Preferences in the Face of Shrinking Civic Space by Suparna Chaudhry, Marc Dotson, and Andrew Heiss
Pandemic Pass? Treaty Derogations and Human Rights Practices During COVID-19 by Suparna Chaudhry, Audrey Comstock, and Andrew Heiss
Data Science for the Social Sciences, Gov 50, Harvard University, taught by Matt Blackwell
Duplicating Quarto elements with code templates to reduce copy and paste errors by Althea A. Archer (United States Geological Survey)
We Converted Our Documentation to Quarto by Melissa Van Bussel (Statistics Canada)
This is what you’ll work on today!
Feature | Quarto |
---|---|
Basic formats | html, pdf, docx, typst |
Beamer | beamer |
PowerPoint | pptx |
HTML slides | revealjs |
Advanced layout | Quarto Article Layout |
Cross references | Quarto Crossrefs |
Websites & blogs | Quarto Websites, Quarto Blogs |
Books | Quarto Books |
Interactivity | Quarto Interactive Documents |
Journal articles | Journal Articles |
Dashboards | Quarto Dashboards |
Quarto is a command line interface (CLI) that renders plain text formats (.qmd
, .rmd
, .md
) OR mixed formats (.ipynb
/Jupyter notebook) into static PDF/Word/HTML reports, books, websites, presentations and more.
Usage: quarto
Version: 1.8.24
Description:
Quarto CLI
Options:
-h, --help - Show this help.
-V, --version - Show the version number for this program.
Commands:
render [input] [args...] - Render files or projects to various document types.
preview [file] [args...] - Render and preview a document or website project.
serve [input] - Serve a Shiny interactive document.
create [type] [commands...] - Create a Quarto project or extension
create-project [dir] - Create a project for rendering multiple documents
convert <input> - Convert documents to alternate representations.
pandoc [args...] - Run the version of Pandoc embedded within Quarto.
typst [args...] - Run the version of Typst embedded within Quarto.
run [script] [args...] - Run a TypeScript, R, Python, or Lua script.
add <extension> - Add an extension to this folder or project
install [target...] - Installs an extension or global dependency.
publish [provider] [path] - Publish a document or project to a provider.
check [target] - Verify correct functioning of Quarto installation.
help [command] - Show this help or the help of a sub-command.
jupyter
or knitr
evaluates Python, Julia, R, or Observable code and returns a .md
file along with the evaluated code.md
file by Pandoc and converted to a final output formatIllustration by Allison Horst
You have a couple options for following along today:
Go to the course website and click on Setup
in the sidebar.
Follow the instructions for either Option 1 or Option 2.
05:00
.qmd
file.⌘⇧K
Ctrl + Shift + K
⌘⇧K
Ctrl + Shift + K
Requires Quarto Extension for VS Code
01-exercise.qmd
05:00
.qmd
file format with three components:
YAML: Metadata
Text: Markdown
Code: R, Python, Observable, and Julia
Weave it all together, and you have beautiful, powerful, and useful outputs!
Metadata: YAML
Text: Markdown
my-document.qmd
Text: Markdown
my-document.qmd
↓
The
gapminder.csv
dataset contains data from the Gapminder foundation.
Text: Markdown
Markdown syntax | Output |
---|---|
|
italics and bold |
|
superscript2 / subscript2 |
|
|
|
verbatim code |
Code
my-document.qmd
---
title: "My Cool Document"
format: html
---
The `gapminder.csv` dataset contains data from the [**Gapminder foundation**](https://www.gapminder.org/).
```{r}
library(tidyverse)
df <- read_csv("data/gapminder.csv")
ggplot(df, aes(x = gdpPercap, y = lifeExp)) +
geom_point(aes(size = pop, color = continent)) +
scale_x_log10()
```
Code
my-document.qmd
---
title: "My Cool Document"
format: html
---
The `gapminder.csv` dataset contains data from the [**Gapminder foundation**](https://www.gapminder.org/).
```{r}
library(tidyverse)
df <- read_csv("data/gapminder.csv")
ggplot(df, aes(x = gdpPercap, y = lifeExp)) +
geom_point(aes(size = pop, color = continent)) +
scale_x_log10()
```
{}
Inline code executes code within Markdown
↓
There are 147 countries in the dataset.
Code can include optional chunk options, in YAML style, identified by #|
at the beginning of the line
my-document.qmd
The `gapminder.csv` dataset contains data from the [**Gapminder foundation**](https://www.gapminder.org/).
```{r}
#| label: fig-neat-plot
#| echo: false
#| fig-width: 6
#| fig-height: 3.8
#| fig-cap: "My neat plot"
library(tidyverse)
df <- read_csv("data/gapminder.csv")
ggplot(df, aes(x = gdpPercap, y = lifeExp)) +
geom_point(aes(size = pop, color = continent)) +
scale_x_log10()
```
Code can include optional chunk options, in YAML style, identified by #|
at the beginning of the line
Option | Description |
---|---|
eval |
Evaluate the code chunk |
echo |
Include the source code |
warning |
Include warnings |
include |
Include code and results |
01-exercise.qmd
and run some of the code chunks (in order!).#| include: false
to the second chunk and preview again. Switch it back to true
or remove it. Preview again.author
field and add your name. Preview again.code-fold
to be true. Preview again.https://www.gapminder.org
XXXX
and YYYY
with inline code instead of hardcoded values. The first code chunk creates R objects named first_year
and last_year
—use those.05:00
Markdown syntax | Output |
---|---|
|
https://quarto.org |
|
Quarto |
|
![]() |
↓
Right | Left | Default | Center |
---|---|---|---|
12 | 12 | 12 | 12 |
123 | 123 | 123 | 123 |
1 | 1 | 1 | 1 |
↓
Right | Left | Default | Center |
---|---|---|---|
12 | 12 | 12 | 12 |
123 | 123 | 123 | 123 |
1 | 1 | 1 | 1 |
my-document.qmd
↓
Computers are neat (Lovelace 1842).
References
Lovelace, Ada Augusta. 1842. “Sketch of the Analytical Engine Invented by Charles Babbage, by LF Menabrea, Officer of the Military Engineers, with Notes Upon the Memoir by the Translator.” Taylor’s Scientific Memoirs 3: 666–731.
my-document.qmd
↓
Computers are neat (Lovelace, 1842).
References
Lovelace, A. A. (1842). Sketch of the analytical engine invented by Charles Babbage, by LF Menabrea, officer of the military engineers, with notes upon the memoir by the translator. Taylor’s Scientific Memoirs, 3, 666–731.
my-document.qmd
↓
Computers are neat1.
Footnotes
- Ada Augusta Lovelace, “Sketch of the Analytical Engine Invented by Charles Babbage, by LF Menabrea, Officer of the Military Engineers, with Notes Upon the Memoir by the Translator,” Taylor’s Scientific Memoirs 3 (1842): 666–731.↩︎
Zotero + Better BibTeX can manage references and export them for Quarto
10,000 bibliographic styles are available at https://www.zotero.org/styles
my-document.qmd
↓
See Figure 1 for more details.
…
Figure 1: My neat plot
For further customization, you can add classes, attributes, and other identifiers to content using divs and spans.
Divs
Spans
Callout blocks
my-document.qmd
Tip
Note that there are five types of callouts, including: note
, tip
, warning
, caution
, and important
.
Multiple columns
my-document.qmd
Photo by The New York Public Library on Unsplash
Tabsets
This is text that is red.
important
callout box to the introduction summarizing the report’s findings. Preview the file.#ec008b
. Preview again.bib/references.bib
. Preview again.05:00