> [!SUMMARY]
> Quarto is an open source publishing system for technical and scientific documents from [Posit](https://posit.co/) (formerly RStudio) that can be use to include narrative text, code and results formatted as documents, webpages, blog posts, books, etc.. You can mix text, code, and the output from code in a single document. It supports code in multiple programming languages R, Python, Julia, and Observable JavaScript.
![[Pasted image 20240919142731.png]]
<font color="#2DC26B">Source of graphic - [Quarto](https://quarto.org/)</font> Note: Example quarto document contains R code. See [[R Overview]].
### What is Quarto? Why use Quarto?
>[!Quarto :: Text, Code, Output]
>#### Quarto® is an open-source scientific and technical publishing system for data deliverables. Quarto is from RStudio and is built on [Pandoc](https://pandoc.org/) (a universal document converter).
>You can weave together narrative text and code to produce elegantly formatted output as documents, web pages, blog posts, books and more.
>
>[Quarto](https://quarto.org/) is
> - A system to publish high-quality articles, reports, presentations, websites, blogs, and books in a number of static and dynamic output formts: HTML, PDF, MS Word, MS PowerPoint, ePub, and more.
> - A system to author scientific markdown, including equations, citations, cross references, figure panels, callouts, advanced layout, and more.
> - Quarto documents are fully reproducible. You can use a single Quarto file to both **save and execute R code** and to **generate high quality reports that can be shared**.
>- A next-generation version of [R Markdown](obsidian://open?vault=Excel&file=030%20R%2FR%20Resources%2FMarkdown%2FR%20Markdown) from [RStudio](https://www.rstudio.com/products/rstudio/), and includes dozens of new features and capabilities while at the same being able to render most existing Rmd files without modification.
>- You can author documents as plain text markdown or [Jupyter](https://jupyter.org/) notebooks.
>- A multi-language system; you can create dynamic content in [R](https://quarto.org/docs/computations/r.html) along with [Python](https://quarto.org/docs/computations/python.html), [Julia](https://quarto.org/docs/computations/julia.html), and [Observable](https://quarto.org/docs/computations/ojs.html).
> - Use multiple development environments: VS Code, RStudio, Jupyter, text editors, etc.
> - Use extensions to do more: article templates, shortcodes for icons, presentation themes
> - R Markdown, and now Quarto, are attempts at [[Literate Programming]].
>
>
> A Quarto document is a plain text file with an extension of `.qmd` .
> A Quarto is the format of a book or pamphlet produced from full sheets printed with eight pages of text, four to a side, then folded twice to produce four leaves. The earliest known European printed book is a Quarto, the Sibyllenbuch, believed to have been printed by Johannes Gutenberg in 1452–53. - Thomas Mock ([Get Started with Quarto – intro-quarto (jthomasmock.github.io)](https://jthomasmock.github.io/quarto-in-two-hours/materials/01-intro-quarto.html#/why-quarto1))
### Next Generation [[R Markdown]]
RStudio has developed [Quarto](https://quarto.org/ "Quarto from RStudio"), a next-generation, R Markdown-like publishing system, as **open source**, and so that it works with R, Python, Julia, Observable JavaScript, and Jupyter notebooks . It’s not a language-specific library, but an external software application. Quarto is a command line interface tool (Quarto CLI), not an R package. You need the Quarto CLI, but you don’t need to explicitly install it or load it, as RStudio automatically does both when needed.
Unlike R Markdown, which is an _R package_, Quarto is a separate, non-R application. So in order to use Quarto, you will first need to download and install it like you would any other software, in this case from the [quarto.org “Get Started” page](https://quarto.org/docs/get-started/). Make sure you have an up-to-date version of RStudio if that’s your IDE, since only more recent versions will run Quarto. For Visual Studio Code, install the [VS Code Quarto extension](https://marketplace.visualstudio.com/items?itemName=quarto.quarto)
Sources: [Quarto](https://quarto.org/) and [Tutorial: Hello, Quarto](https://quarto.org/docs/get-started/hello/rstudio.html)
### Getting Started
In order to use Quarto, you will first need to download and install it like you would any other software, in this case from the [quarto.org “Get Started” page](https://quarto.org/docs/get-started/). You need an up-to-date version of RStudio if that’s your IDE, since only more recent versions will run Quarto. For Visual Studio Code, install the [VS Code Quarto extension](https://marketplace.visualstudio.com/items?itemName=quarto.quarto). Quarto documents are created in .qmd files (a type of text file).
### Writing Quarto Documents
Use Markdown or use the visual editor to write an Quarto document. [[Markdown Syntax]] is simple yet gives another set of things to remember. For example, to bold a word, surround it with two asterisks:
This code:
```{r echo}
**bold this text**
```
results in :
**bold this text**
The [visual markdown editor](https://quarto.org/docs/visual-editor/) in RStudio makes using Quarto easier. The visual is s WYSIWYG editor similar to Microsoft Word. Per RStudio, the visual editor will eventually also be made available in standalone form.
> [!Info] The Quarto visual editor provides a [WYSIWYM](https://en.wikipedia.org/wiki/WYSIWYM) editing interface for all of Pandoc markdown, including tables, citations, cross-references, footnotes, divs/spans, definition lists, attributes, raw HTML/TeX, and more.
> **WYSIWYM** = **What You See Is What You Mean**
### How it Works
See [How it Works](https://quarto.org/docs/get-started/hello/rstudio.html#how-it-works) at Quarto.org.
When you render a Quarto document, first [knitr](http://yihui.name/knitr/) executes all of the code chunks and creates a new markdown (.md) document which includes the code and its output. The markdown file generated is then processed by [pandoc](http://pandoc.org/), which creates the finished format. The Render button in R Studio encapsulates these actions and executes them in the right order.

Source- Quarto.org
### R Markdown and Quarto
Like R Markdown, Quarto uses [Knitr](https://yihui.org/knitr/) to execute R code, and is therefore able to render most existing Rmd files without modification. See [[R Markdown]].
### Using Quarto with R
You can author Quarto documents in RStudio.
The [latest release](https://rstudio.com/products/rstudio/download/) of RStudio (v2022.02 or later) includes support for editing and preview of Quarto documents. You can download RStudio v2022.02 or later from [https://rstudio.com/products/rstudio/download/](https://rstudio.com/products/rstudio/download/).
If you are using Quarto within RStudio it is **strongly** recommended that you use this version or a later version.
### Multiple Programming Languages
You can produce documents in multiple programming languages, including in [R](https://quarto.org/docs/computations/r.html) along with [Python](https://quarto.org/docs/computations/python.html), [Julia](https://quarto.org/docs/computations/julia.html), and [Observable](https://quarto.org/docs/computations/ojs.html).
### Multiple Output Formats
You can produce various document formats using the same source code and add components like table of contents, equations, citations, etc..
You can publish high-quality articles, reports, [presentations]([Quarto - Presentations](https://quarto.org/docs/presentations/)), [websites]([Quarto - Creating a Website](https://quarto.org/docs/websites/)), [Shiny interatctive web apps]([Quarto - Shiny](https://quarto.org/docs/interactive/shiny/)), blogs, [projects]([Quarto - Project Basics](https://quarto.org/docs/projects/quarto-projects.html)), and [books]([Quarto - Creating a Book](https://quarto.org/docs/books/)) in [HTML]([Quarto - HTML Basics](https://quarto.org/docs/output-formats/html-basics.html)), [PDF]([Quarto - PDF Basics](https://quarto.org/docs/output-formats/pdf-basics.html)), [MS Word]([Quarto - Word Basics](https://quarto.org/docs/output-formats/ms-word.html)), [MS PowerPoint]([Quarto - PowerPoint](https://quarto.org/docs/presentations/powerpoint.html)), [ePub]([Quarto - ePub Options](https://quarto.org/docs/reference/formats/epub.html)), and more.
How to [[Create a Website with Quarto]]
### Executable Code
Quarto supports executable code blocks within markdown allowing you to create fully reproducible documents and reports. The code required to produce your output is part of the document itself, and is automatically re-run whenever the document is rendered.
### Components of a Quarto File
Quarto files have 3 types of content:
1. **YAML (Metadata) Header.** *Optional* Each Quarto file can have a "YAML header", which is a section of rmd file that is at the top where many of the settings or options for file creation are placed. In RStudio, these often update automatically as different settings are invoked in the Options menu. The YAML header is surrounded by `---`s.
2. **R Code Chunks.** R code within a Quarto file can be included in two ways, either as in-line code (e.g., the total number of oranges was `` `r`` ``sum(fruit$oranges)` `` or as a “chunk." R code chunks surrounded by ` ``` `s.
3. **Markdown text.** Markdown text can be included as narrative around your chunks of code. The text is mixed with simple text formatting. Adding narrative with your code is a great way of getting into the habit of explicitly documenting your analysis. When you come back to a file many months later, all of your thinking (and code and analytical approach and data used) is there, rather than having to work out exactly what you did! Adding narrative can also assist others in reproducing your data analysis objectives.
#### YAML Header
It is possible to set different options for different output types by including these in the [[YAML header]]:
````
---
title: "Notebook"
output:
html_document:
toc: true
toc_float:
collapsed: true
smooth_scroll: true
toc_depth: 4
number_sections: true
rmarkdown::theme: architect
highlight: tango
code_download: yes
fig_width: 5
fig_height: 8
fig_caption: true
code_folding: hide
pdf_document:
fig_height: 3
fig_width: 4
---
````
### Other Resources
[[Quarto Output Formats]]
[[Quarto Code Block Options]]
[[Quarto Callout Blocks]]
[[Quarto Document Template]]
[[Quarto Workspace]]
[[Quarto Data Summary Tables]]
***
2024 cloudedknowledge.net