Getting Started with Quarto - jonathancolmer/lab-guide GitHub Wiki
Quarto is a publishing system in which users can combine multiple coding languages to generate figures within narrative text. It can be used to create papers with embedded figures, interactive databases, and more.
1. Setting up Quarto
Installation
Quarto can be used on platforms such as VS code and RStudio. You can download and install Quarto from the Quarto website. From there, you can choose an environment to run Quarto in. Assuming you have already downloaded RStudio or VS code, Quarto will automatically transfer into the platform.
2. Quarto Basics
Creating a Script
Quarto documents use the β.qmdβ file extension. You can create a Quarto script in RStudio by clicking on the arrow next to the "new file" icon in the top left corner and choosing a Quarto document. From there, Quarto will open a window that prompts you to title the document and select an output system. Quarto can render in HTML, PDF, or Word formats, but whichever option you choose can be edited later. You can also choose between a document,a presentation, and an interactive.
Format
Upon generation, the document will contain a generic base format. Every Quarto document begins with a YAML section which sets up the rest of the document. YAML is a readable language which is used to define configuration settings for the document. The YAML section begins and ends with ---
. Within the section, you can set formatting styles, fonts, and outputs.
From there, you can customize the rest of the document using different coding languages. If you write straight into the document, it is in the default language which is Rmarkdown. You can create a chunk of a different language using three backticks (```) at the beginning and end of the code. Specify the code by adding a {r}
or a `{latex=}` after the first three backticks. Everything that you write within the code chunk will be in the specified language.
Rendering
In RStudio you can render by clicking the βRenderβ button in the middle of the top bar. In addition, you can also render from a separate R script using the Quarto render command
quarto::quarto_render(
input = "path/to/quarto.qmd"
)
You can specify the output in the YAML of the Quarto or in the separate R script.
Markdown Syntax
`code`
β in-text code
\vspace{1em} β spacing
\leaguegothic\textcolor{custommaroon}{\Huge\textbf{Race and Ethnicity}}
leaguegothic β font
custommaroon β text color
Huge β text size
textbf{} β bold
textit{} β italisized
List: \begin{itemize} \item \end{itemize}
LaTeX Syntax
Adding Box:
\begin{tcolorbox}[
colback=background fill color,
colframe=border color,
boxrule=0pt (border thickness),
arc=0pt (corner roundness),
left=12pt, right=12pt, top=10pt, bottom=10pt (padding)
]
\end{tcolorbox}
Adding Image:
\includegraphics[width=1\linewidth]{myplot.png}
Columns
\columnratio{.35}
\begin{paracol}{2}
\switchcolumn
\end{paracol}