Dynamic APA-formatted manuscripts with papaja
Humboldt-Universität zu Berlin
2024-06-18
Today we will…
papaja manual (Aust & Barth, 2023)
papajatinytexreferences.bibtinytexpapajaI want to add a citation
papaja
a package specifically for writing APA-formatted manuscripts
File > New File > R markdown > From template > APA-formatted article (papaja)
number_sections: TRUE in our YAML{#section_label} or \label{section_label}
\ref{}, and the section number will be produced in the outputFigure 1
now if we were to write As seen in Figure \ref{fig-iris}, we would get: As seen in Figure 1
be careful not to use underscores (_) in your figure labels, this causes problems
iris dataset (figure from Mijwil & Abttan, 2021)
\ref{}
Figure 2: Visual depiction of dependent variables from the iris dataset
we can write example sentences with latex syntax
first, add this to your YAML
See example \ref{ex:example}, which will be written as: See example 1
knitr::kable() or papaja::apa_table()
```{r apa-table, eval=F, echo = "fenced"}
library(tidyverse)
tribble(
~"Item", ~"Condition", ~"Sentence",
"1", "a", "Example sentence of condition A",
"1", "b", "Example sentence of condition B",
"1", "c", "Example sentence of condition C",
"1", "d", "Example sentence of condition D",
) |>
papaja::apa_table(caption = "Example stimuli")
```| Item | Condition | Sentence |
|---|---|---|
| 1 | a | Example sentence of condition A |
| 1 | b | Example sentence of condition B |
| 1 | c | Example sentence of condition C |
| 1 | d | Example sentence of condition D |
Table apa-table for example stimuli” will print:
{r apa-table, echo=F, eval=T}. + remember to use \ref{tab:label} and replace label with yours (i.e., don’t forget the tab: prefix).iris measures
| Species | Sepal.Length | Sepal.Width | Petal.Length | Petal.Width |
|---|---|---|---|---|
| setosa | 5.006 | 3.428 | 1.462 | 0.246 |
| versicolor | 5.936 | 2.770 | 4.260 | 1.326 |
| virginica | 6.588 | 2.974 | 5.552 | 2.026 |
Mean values are given in Table \ref{tab:iris-table}.
floatsintext: in the YAML to yes (it will be no by default)
papaja pushes all tables and figures to the very end of the document.bib file
.bib file to use in your YAML (we currently have bibliography: r-references.bib)knuth1984literate).bib file@
@knuth1984literate we should get a formatted citation: Knuth (1984)
[@knuth1984literate] we would get the reference in brackets (Knuth, 1984)
keep_tex: true
keep_tex: true to your YAML.tex output in the foldertex file to an Overleaf projecttrackdown package which integrates R markdown scripts with Google Docs
bookdown, see the website for more: https://bookdown.org/oxforddown template