Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
27 views

quarto.cheat.sheet

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

quarto.cheat.sheet

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Publish and Share with Quarto : : CHEATSHEET

Author Render Publish


WRITE AND CODE IN GENERATE DOCUMENTS, SHARE YOUR WORK
PLAIN TEXT PRESENTATIONS AND MORE WITH THE WORLD GET QUARTO
https://quarto.org/docs/download/
Author documents as .qmd files Produce HTML, PDF, MS Word Quickly deploy to Or use version bundled with RStudio
or Jupyter notebooks. reveal.js, MS Powerpoint, Beamer GitHub Pages, Netlify, Quarto Pub,
Write in a rich Markdown syntax. Websites, blogs, books... Posit Cloud, or Posit Connect GET STARTED
https://quarto.org/docs/get-started/

Author Render Publish


SOURCE FILE: hello.qmd RENDERED OUTPUT: hello.html Terminal
quarto publish {venue} hello.qmd
---
title: "Hello, Penguins" {venue}: quarto-pub, connect, gh-pages, netlify,
format: html Set format(s) and options
confluence, posit-cloud
execute: Use YAML Syntax
echo: false
Use Publish button
---

## Meet the penguins


## Write with **Markdown** Free publishing service for
The `penguins` data contains RStudio: Help > Markdownfor
size measurements Quickpenguins
Reference Quarto content.
from three islands in the Palmer Archipelago, Antarctica. Features for scientific
Use Visual Editor publishing Cloud-hosted, control access
The three species of penguins have quite distinct Cross references, citations, to project and output.
distributions of physical dimensions (@fig-penguins). equations, and more
Org-hosted, control access,
schedule updates.
```{r} Include code
#| label: fig-penguins R, Python, Julia, Observable,
#| fig-cap: "Dimensions of penguins across three
or any species."
language with a
#| warning: false
library(tidyverse, quietly = TRUE)
Jupyter kernel
Output integrated into document Quarto Projects
library(palmerpenguins) Control how output appears with
special comments in your code CREATE WEBSITES, BOOKS, AND MORE
penguins |>
ggplot(aes(x = flipper_length_mm, y = bill_length_mm)) + A directory of Quarto documents +
geom_point(aes(color = species)) + a configuration file (_quarto.yml)
scale_color_manual( See examples at https://quarto.org/docs/gallery/
values = c("darkorange", "purple", "cyan4")) +
Get started from the command line:
Terminal
quarto create project {type}
USE A TOOL WITH A RICH EDITING Save, then render to preview the
OR ANY TEXT EDITOR document output. BEHIND THE SCENES
EXPERIENCE {type}: default, website, blog, book, confluence,
Quarto documents (.qmd) can be When you render a document, Quarto:
Terminal manuscript
Visual Studio Code + edited in any tool that edits text. Terminal
RStudio quarto preview hello.qmd 1. Runs the code and embeds results
Quarto extension
and text into an .md file with: Use File > New Project
Run code cells as you write Knitr, if any {r} cells or,
Apply formatting in Insert elements like Use Render button Jupyter, if any other cells.
Visual Editor. Saved code cells, cross
Render with a button or keyboard shortcut as Markdown in references, and 2. Converts the .md file into the output
Use Preview button
source. more. format with Pandoc.
Edit Quarto documents with a Visual Editor
The resulting HTML/PDF/MS Word/etc. Artwork from "Hello, Quarto" keynote by Julia Lowndes
document will be created and saved in the and Mine Çetinkaya-Rundel, presented at RStudio
same directory as the source .qmd file. Conference 2022. Illustrated by Allison Horst.

CC BY SA Posit So ware, PBC • info@posit.co • posit.co • Learn more at quarto.org • HTML cheatsheets at pos.it/cheatsheets • Quarto 1.4 • Updated: 2024-05
ft
html/revealjs
pdf/beamer
Include Code Set Format and Options

docx/pptx
CODE CELLS SET FORMAT OPTIONS MULTIPLE FORMATS OPTION DESCRIPTION
Code cells start with ```{language} and end with ```. toc X X X Add a table of contents (true or false)
---

Nav
--- toc-depth X X X Lowest level of headings to add to table of contents (e.g. 2, 3)
Use Insert Code Chunk/Cell title: "My Document" title: "My Document"
format:
anchor-sections X Show section anchors on mouse hover (true or false)
toc: true
html: format: highlight-style X X X Syntax highlighting theme (e.g. arrow, pygments, kate, zenburn)
```{r} ```{python}
#| label: chunk-id #| label: chunk-id code-fold: true html: mainfont, monofont X X Font name. HTML: sets CSS font-family; LaTeX: via fontspec package

Style
toc: true code-fold: true theme X Bootswatch theme name (e.g. cosmo, darkly, solar etc.)

Also use in code cells


library(tidyverse) import pandas as pd
``` ``` --- pdf: default css X CSS or SCSS file to use to style the document (e.g. "style.css")
---
reference-doc X docx/pptx file containing template styles (e.g. file.docx, file.pptx)
Indent options 4
Other languages: {julia}, {ojs} spaces Files of content to include in header of output document, also include-
include-in-header X X
Add code cell options with #| comments. Top-level options before-body, include-a er-body
Indent format 2 apply to all formats
spaces keep-md X X X Keep intermediate markdown (true or false), also keep-ipynb, keep-tex
Cell options control execution, figures, tables, layout
and more. See them all at: documentclass X LaTeX document class, set document class options with classoption

LaTeX
https://quarto.org/docs/reference/cells Common formats: html, pdf, docx, odt, rtf,
gfm, pptx, revealjs, beamer pdf-engine X LaTeX engine to produce PDF output (xelatex, pdflatex, lualatex)
EXECUTION OPTIONS cite-method X Method used to format citations (citeproc, natbib, biblatex)
Render all formats: code-fold X Let readers toggle the display of R code (false, true, or show) 

Code
OPTION DEFAULT EFFECTS
Terminal code-tools X Add menu for hiding, showing, and downloading code (true or false)
echo true false: hide code quarto render hello.qmd code-overflow X Display of wide code (scroll, or wrap) 
fenced: include code cell syntax
fig-align X X / Alignment of figures (default, le , right, or center) 

Figures
eval true false: don’t run code Render a specific format: fig-width, fig-height X X X Default width and height for figures in inches Knitr
Terminal
include true false: don’t include code or results fig-format X X X Format for Matplotlib or R figures (retina, png, jpeg, svg, or pdf)
quarto render hello.qmd --to pdf
Visit https://quarto.org/docs/reference/ to see all options by format
output true false: don’t include results
asis: treat results as raw markdown
TABLES 
warning true false: don’t include warnings in output

true: include error in output and


Add Content MARKDOWN
COMPUTATION Output a Markdown table or an HTML table from your code
KNITR JUPYTER Add Markdown()to Markdown output:
error false
continue with render
FIGURES  Use knitr::kable() to produce
MARKDOWN ```{python}
|object | radius| Markdown:
Set execution options at the cell level: #| label: tbl-LABEL
|:------|------:|
![CAP](image.png){#fig-LABEL fig-alt="ALT"} ```{r} #| tbl-cap: CAPTION
```{r} ```{python} |Sun | 696000|
#| label: tbl-LABEL import pandas as pd, tabulate
#| echo: false #| echo: false |Earth | 6371|
COMPUTATION #| tbl-cap: CAPTION from IPython.display import Markdown
``` ```
knitr::kable(head(cars)) df = pd.DataFrame({"A": [1, 2],
```{python} Or {r} : CAPTION {#tbl-LABEL}
``` "B": [1, 2]})
Or, globally in the YAML header with the execute option: #| label: fig-LABEL
Markdown(df.to_markdown(index=False))
#| fig-cap: CAP Use Insert Table in Also see the R packages: gt, ```
Set options in code #| fig-alt: ALT the Visual Editor flextable, kableExtra.
---
cells with #| {{ plot code here }}
execute:
comments and YAML ```
echo: false syntax: CITATIONS CALLOUTS
--- key: value 1. Add a bibliography file to the YAML header: Instead of tip use one of:
CROSS REFERENCES ::: {.callout-tip} note, caution, warning,
1. Add labels --- ## Title or important.
INLINE CODE Code cell: add option label: prefix-LABEL bibliography: references.bib
Use computed values directly in text sections. Markdown: add attribute #prefix-LABEL --- Text
Code is evaluated at render and results appear as 2. Add references @prefix-LABEL, e.g. :::
text. 2. Add citations: [@citation], or @citation
You can see in @fig-scatterplot,
KNITR JUPYTER OUTPUT that...
Use Insert Citations dialog in the SHORTCODES
Value is `r 2 + 2`. Value is `{python} 2 + 2`. Value is 4.
Visual Editor {{< include _file.qmd >}}
Prefix Renders Prefix Renders
g- Figure 1 eq- Equation 1 Build your bibliography file from your Zotero library, {{< embed file.ipynb#id >}}
DOI, Crossref, DataCite, or PubMed {{< video video.mp4 >}}
tbl- Table 1 sec- Section 1

CC BY SA Posit So ware, PBC • info@posit.co • posit.co • Learn more at quarto.org • HTML cheatsheets at pos.it/cheatsheets • Quarto 1.3 • Updated: 2023-07
fi
ft
ft
ft

You might also like