Working with Quarto Documents
What is Quarto and why should you use it?
Quarto is a file format for weaving together code (R, python, and others), output, and text into a single notebook. It is a nice tool for putting together reports or doing analysis for yourself. Quarto also has applications for building websites (this website is build with Quarto!), formatting books, and making slideshow presentations. These are advanced applications that over time, you may want to try out yourself.
While Quarto offers many advanced features, using only the basic features will enable users of many abilities to communicate their results with others. You can choose to learn more, but Quarto is nevertheless useful using only its foundational tools: mixing text, code, and code outputs.
It follows some of the standard syntax of markdown, which is a highly simplified version of HTML (“hypertext markup language”).
A .qmd document can simply exist as is (and is highly useful), or you can choose to output it to many enabled formats such as .html (the easiest to do), .pdf, .docx and more. Click on “Render” at the top of a .qmd file in RStudio to see a rendered version of your Quarto document.
Basics of quarto
Text Formatting
Markdown Syntax | Output |
---|---|
|
italics and bold |
|
superscript2 / subscript2 |
|
|
|
verbatim code |
Headings
Markdown Syntax | Output |
---|---|
|
Header 1 |
|
Header 2 |
|
Header 3 |
|
Header 4 |
|
Header 5 |
|
Header 6 |
Lists
Markdown Syntax | Output |
---|---|
|
|
|
|
|
|
|
continues after
|
|
|
Source Code
Use ```
to delimit blocks of source code:
```
code
```
Add a language to syntax highlight code blocks:
```r
1 + 1
```
If you are creating HTML output there is a wide variety of options available for code block output. See the article on code blocks for additional details.
Tables
Markdown Syntax
| Right | Left | Default | Center |
|------:|:-----|---------|:------:|
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
Output
Right | Left | Default | Center |
---|---|---|---|
12 | 12 | 12 | 12 |
123 | 123 | 123 | 123 |
1 | 1 | 1 | 1 |
There are many more options for formatting Quarto documents and embedding information in a Quarto document. Visit Quarto’s markdown page to learn more.
What else can quarto be used for?
There is a rich array of possibilities for Quarto documents, the majority of which we will not address in this class. Take a look at this gallery to get a better sense of what you can do with Quarto and decide for yourself if it’s worth the effort to learn better.
I started learning how to use markdown for html documents, then made a few presentations with Quarto’s predecessor, Rmarkdown (I’m not sure this is worth the effort). I next started building website with Rmarkdown and Quarto, and have found this to be a great tool for sharing information via websites. If you never do this, that is completely okay! Not everyone neesd these tools, but it you do, Quarto can make implementation easier.