10:00
Session 1: Getting to know Quarto
Tuesday, July 18, 2023
Quarto supports
a standardized schema for key details like authors and affiliations that can be expressed once in the source document,
cross-referencing of figures, tables, equations etc., and
the use of Citation Style Language (CSL) to automate the formatting of citations and bibliographies,
outputting to pdf, html, and docx with custom formatting,
---
title: "Toward a Unified Theory of High-Energy Metaphysics: Silly String Theory"
date: 2008-02-29
author:
- name: Josiah Carberry
id: jc
orcid: 0000-0002-1825-0097
email: josiah@psychoceramics.org
affiliation:
- name: Brown University
city: Providence
state: RI
url: www.brown.edu
abstract: >
The characteristic theme of the works of Stone is
the bridge between culture and society. ...
keywords:
- Metaphysics
- String Theory
license: "CC BY"
copyright:
holder: Josiah Carberry
year: 2008
citation:
container-title: Journal of Psychoceramics
volume: 1
issue: 1
doi: 10.5555/12345678
funding: "The author received no specific funding for this work."
---
knitr (R) or jupyter (python)The following include-in-* options allow you to include contents of a file (e.g. file.tex) verbatim at certain positions:
| Option | Position | Use Cases |
|---|---|---|
include-in-header |
end of the header before |
Inject commands into the LaTeX preamble |
include-before-body |
beginning of the document body after |
Include navigation bars or banners in HTML |
include-after-body |
end of the document body before |
There are two ways to produce a LaTex file (.tex) using options specificed in the YAML header:
latex format instead of pdfor just use Visual Mode!
Markdown:
{fig-align="left" height="200px"}
Output (HTML):

Markdown:
{fig-align="right" height="200px"}
Output (HTML):

Markdown:
::: {#fig-penguins layout-ncol=2}
{#fig-blue width="250px"}
{#fig-orange width="250px"}
Two penguins
:::
Output (LaTex):
\begin{figure}
\begin{minipage}[t]{0.50\linewidth}
{\centering
\raisebox{-\height}{
\includegraphics[width=2.60417in,height=\textheight]{images/blue-penguin.png}
}
}
\subcaption{\label{fig-blue}Blue penguin}
\end{minipage}%
%
\begin{minipage}[t]{0.50\linewidth}
{\centering
\raisebox{-\height}{
\includegraphics[width=2.60417in,height=\textheight]{images/orange-penguin.png}
}
}
\subcaption{\label{fig-sleep}Orange penguin}
\end{minipage}%
\caption{\label{fig-penguins}Two penguins}
\end{figure}Output (PDF):
Quarto can some options specific to LaTex output such as figure position and environments
---
title: "Sidenotes"
format:
pdf:
fig-pos: 'h'
include-in-header:
text: |
\usepackage{mdframed}
---
{fig-env="mdframed"}See PDF Reference > Figures for available options
Pandoc (and thus Quarto) allows for mixing raw LaTex with markdown when creating PDF documents. For example:
\begin{tabular}{|l|l|}\hline
Age & Frequency \\ \hline
18--25 & 15 \\
26--35 & 33 \\
36--45 & 22 \\ \hline
\end{tabular}Warning
Note that raw LaTex will not be rendered in HTML format. However, if you have existing LaTex content (e.g. from STATA) that can’t be re-exported or re-written in markdown this is a useful option.
my_first_article.qmd inside your last Rproject.10:00
Journal Article extensions offer templates to adapt an existing .qmd document
| Journal / Publisher | Name |
|---|---|
| Association of Computing Machinery | acm |
| American Chemical Society | acs |
| American Geophysical Union | agu |
| Biophysical journal | biophysical-journal |
| Elsevier Journals* | elsevier |
| American Statistical Association Journals | jasa |
| Journal of Statistical Software | jss |
| Public Library of Science | plos |
The quarto use template command can be used to create an article from one these formats, e.g. for Elsevier:
Let’s write an article together for Elsevier and showcase the following features of Quarto journal articles:
PDF output
Extended YAML front matter
Reference management