Markdown, Citations, and Cross-References
March 25, 2026
I recommend using the Source editor (e.g., in YAML editor: source), as it helps you understand the underlying syntax
Text formatting and structure
| Markdown | Output |
|---|---|
**bold** |
bold |
*italic* |
italic |
***bold italic*** |
bold italic |
`code` |
code |
~~strikethrough~~ |
|
H~2~O |
H2O |
R^2^ |
R2 |
Tip
In a Quarto book, H1 (#) is reserved for the chapter title in the YAML. Use H2 (##) for your first-level sections within a chapter.
This is a blockquote. Useful for quoting stimuli or definitions.
– Attributed author
This is a blockquote. Useful for quoting stimuli.
Tip
A tip callout.
Note
A note callout.
Warning
A warning callout.
Important
An important callout.
BibTeX, Zotero, and APA formatting
In your YAML:
references.bib: BibTeX file with your references
apa.csl: Citation Style Language file for APA formatting
Tip
Download apa.csl from the Zotero CSL repository or run:
| Syntax | Output |
|---|---|
@Bates2015 |
Bates et al. (2015) |
[@Bates2015] |
(Bates et al., 2015) |
[-@Bates2015] |
(2015) |
[@Bates2015, p. 12] |
(Bates et al., 2015, p. 12) |
[@Bates2015; @Gelman2020] |
(Bates et al., 2015; Gelman, 2020) |
Mixed-effects models were fitted following Bates et al. (2015). All analyses were conducted in R (R Core Team, 2024).
references.bibdoi2bib.org to generate BibTeX from a DOIcitation("lme4") gives a citable referencecsl: apa.csl: Quarto handles the rest automatically@Bates2015 → Bates et al. (2015)references.qmd with ::: {#refs} :::.docxNote
For APA 7th edition PDF output, use documentclass: apa7 in your YAML and the apa7 LaTeX class.
Figures, tables, sections, and equations
| Type | Label prefix | Reference |
|---|---|---|
| Figure | fig- |
@fig-mass |
| Table | tbl- |
@tbl-demo |
| Section | sec- |
@sec-results |
| Equation | eq- |
@eq-model |
| Example | exm- |
@exm-stimulus |
## Results {#sec-results}
## Discussion {#sec-discussion}
`As discussed in @sec-results...`
→ “As discussed in in Section 4…”
$$
y_i = \beta_0 + \beta_1 \text{Tense}_i + \beta_2 \text{Lifetime}_i + \varepsilon_i
$$ {#eq-model}
The model is specified in @eq-model.
\[ y_i = \beta_0 + \beta_1 \text{Tense}_i + \beta_2 \text{Lifetime}_i + \varepsilon_i \tag{1}\]
The model is specified in Equation 1.
(@) syntax auto-numbers examples continuously across the document:(@ex-good) The manager hired the assistant.
(@ex-bad) *The assistant was hired the manager.
As shown in (@ex-good), the active form is grammatical.
As shown in (1), the active form is grammatical.
gb4e for PDFgb4e LaTeX package in PDF outputAdd to your YAML:
gb4e is a LaTeX package and only works in PDF output!!gb4eWarning
gb4e cross-references only resolve in PDF output. Use (@) syntax if you need cross-references in both HTML and PDF.
Dynamic values in prose
Embed R values directly in prose:
The sample comprised 48 participants (Mage = 23.4 years).
| Statistic | Markdown | Output |
|---|---|---|
| Mean | *M* = 310.8 |
M = 310.8 |
| SD | *SD* = 155.9 |
SD = 155.9 |
| t-test | *t*(48) = 2.31 |
t(48) = 2.31 |
| p-value | *p* < .001 |
p < .001 |
| Cohen’s d | *d* = 0.45 |
d = 0.45 |
Tip
In APA 7, statistical symbols (M, SD, t, p, F) are italicised. Use *...* in Quarto markdown.
Open exercises/session1.qmd and follow the exercises for Session 1.
~15 minutes
@label syntax with type prefixes(@) for numbered linguistic examplesR for Publication - Day 1: Writing in Quarto