remotes::install_github("crsh/papaja@devel")This is a short blogpost documenting the steps I took to get APA 7 running in papaja for Rmarkdown. I followed more detailed instructions in the blogpost How to set up {papaja} to work with the APA 7 format, and also took a look at an open issue on the papaja GitHub repo on this topic.
Setting up APA 7 in papaja
papaja is an R package for preparing APA-styled articles in Rmarkdown. It’s current version (0.1.2) supports APA 6 guidelines, although the newest guidelines are APA 7. Basically, we need to get papaja to use APA 7.
I achieved this by following these steps:
- Install developer version of
papaja:
- Add to the YAML:
csl : "`r system.file('rmd', 'apa7.csl', package = 'papaja')`"
documentclass : "apa7"And this:
header-includes:
- |
\makeatletter
\renewcommand{\paragraph}{\@startsection{paragraph}{4}{\parindent}%
{0\baselineskip \@plus 0.2ex \@minus 0.2ex}%
{-1em}%
{\normalfont\normalsize\bfseries\typesectitle}}
\renewcommand{\subparagraph}[1]{\@startsection{subparagraph}{5}{1em}%
{0\baselineskip \@plus 0.2ex \@minus 0.2ex}%
{-\z@\relax}%
{\normalfont\normalsize\bfseries\itshape\hspace{\parindent}{#1}\textit{\addperi}}{\relax}}
\makeatotherThis was sufficient for my set-up. The additional LaTeX packages I needed were then listed directly under (and in line with) \makatother.
Testing
To test if APA 7 vs. 6 was being used, I changed a BibTex entry for a reference to have more than 7 authors (e.g., by repeating all the author names until >7). I then changed csl: "/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/papaja/rmd/apa7.csl" to csl: "/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/papaja/rmd/apa6.csl". In the bibliography only 7 authors were listed (following apa 6). I then changed it back to 'apa7.csl, and the rendered bibliography listed all authors (following apa 7). I took this as sufficient evidence that apa 7 was indeed being used. I then changed the BibTex authors back, of course.
YAML
For reference, the YAML in my final metafile looks something like this:
---
title : "Title"
author:
- name : "Daniela Palleschi"
[...]
bibliography : ["references.bib"]
floatsintext : yes
figurelist : yes
numbersections : yes
tablelist : yes
footnotelist : no
linenumbers : yes
mask : no
draft : no
csl : "`r system.file('rmd', 'apa7.csl', package = 'papaja')`"
documentclass : "apa7"
classoption : "man"
keep_tex: true
output:
papaja::apa6_pdf:
# citation_package: natbib # so that the TEX file output will contain LaTeX formatted citations
# natbiboptions: round # so that natbib use parantheses for citations and not square brackets
biblio-style: apalike
authornote: |
\addORCIDlink{Daniela M. Palleschi}{0000-0002-7633-2736}
header-includes:
- |
\makeatletter
\renewcommand{\paragraph}{\@startsection{paragraph}{4}{\parindent}%
{0\baselineskip \@plus 0.2ex \@minus 0.2ex}%
{-1em}%
{\normalfont\normalsize\bfseries\typesectitle}}
\renewcommand{\subparagraph}[1]{\@startsection{subparagraph}{5}{1em}%
{0\baselineskip \@plus 0.2ex \@minus 0.2ex}%
{-\z@\relax}%
{\normalfont\normalsize\bfseries\itshape\hspace{\parindent}{#1}\textit{\addperi}}{\relax}}
\makeatother
\usepackage{float}
\usepackage{multirow}
\usepackage{makecell}
\usepackage{gb4e} \noautomath
\usepackage{dblfloatfix}
\usepackage{hyperref}
\usepackage{booktabs}
\usepackage{array}
\usepackage{caption}
\captionsetup[table]{textfont={it}, labelfont={bf}, singlelinecheck=false, labelsep=newline}
\usepackage{multirow,graphicx}
\usepackage{fdsymbol}
\usepackage{setspace}
\AtBeginEnvironment{tabular}{\singlespacing}
\AtBeginEnvironment{lltable}{\singlespacing}
\AtBeginEnvironment{tablenotes}{\doublespacing}
\captionsetup[table]{font={stretch=1.5}}
\captionsetup[figure]{font={stretch=1.5}}
editor_options:
chunk_output_type: console
---