laserbuddha
laserbuddha

Reputation: 31

Can't change wrong figure/table caption format in papaja document

I'm trying to write a document according to the apa guide, so I wrote it in RStudio and used the papaja package template. But the captions in the figures and tables have the wrong format (see below). The caption text should be in italics and the label should be above the caption text and bold.

So I tried to correct it using the latex "caption" package (see below). And now the table caption is ok. But the figure caption is still wrong (it's in italics and on the same line as caption text.)

The caption package seems to have very limited ability to do any changes to the caption in papaja. The only thing I'm able to do is to change the fonts to bold. (I've tried the caption package in pure rmarkdown and everything works.)

Is there a way to change the figure caption to the right format with the papaja package? I've run out of ideas on what to do.

(Code and images below.)

EDIT1: Update with complete code.

EDIT2: I'm not sure, but it looks like there are several ways of apa formatting when it comes to figure captions. So I guess the figure caption in the last image is ok. (just have to move the caption below the image.) I don't expect to find a solution to this problem so I just have to leave it like this.

Captions without the caption package: wrong format enter image description here

Caption with the caption package. (the table caption has the correct formatting) enter image description here enter image description here

---
title             : "The title"
shorttitle        : "Title"

author: 
  - name          : "First Author"
    affiliation   : "1"
    corresponding : yes    # Define only one corresponding author
    address       : "Postal address"
    email         : "[email protected]"
    role:         # Contributorship roles (e.g., CRediT, https://casrai.org/credit/)
      - Conceptualization
      - Writing - Original Draft Preparation
      - Writing - Review & Editing
  - name          : "Ernst-August Doelle"
    affiliation   : "1,2"
    role:
      - Writing - Review & Editing

affiliation:
  - id            : "1"
    institution   : "Wilhelm-Wundt-University"
  - id            : "2"
    institution   : "Konstanz Business School"

authornote: |
  Add complete departmental affiliations for each author here. Each new line herein must be indented, like this line.

  Enter author note here.

abstract: |
  blablala
  
  
keywords          : "keywords"
wordcount         : "X"

bibliography      : ["r-references.bib"]

floatsintext      : no
figurelist        : no
tablelist         : no
footnotelist      : no
linenumbers       : no
mask              : no
draft             : no
fig_caption       : yes

documentclass     : "apa6"
classoption       : "doc"
output            : papaja::apa6_pdf
header-includes:
  \usepackage{hhline, colortbl}
   \usepackage{wrapfig}
   \usepackage[
    labelsep=newline,
    textfont=it,
    labelfont=bf,
    justification=raggedright,
    singlelinecheck=off
  ]{caption}
---

```{r setup, include = FALSE}
library("papaja")
```

```{=latex}
\begin{figure}
  \caption{My figure caption}
  \label{fig:cbttblock}
  \includegraphics[width=0.4\textwidth]{Figures/CBBTblock.png}
\end{figure}
```


```{=latex}
\begin{table}
  \caption{My table caption} \label{tab:tblSekvens}
  \begin{tabular}{|l||c||c||
    >{\columncolor[HTML]{C0C0C0}}c ||c||c||c||
    >{\columncolor[HTML]{C0C0C0}}c ||c||c|}

    \hhline{*{9}{-||}-}
    \textbf{\begin{tabular}[c]{@{}l@{}}Peksekvens \\ Försöksledare\end{tabular}}   
      & A & B & C & D & E & F & G & H & I \\

    \hhline{*{9}{=::}=}
    \textbf{Pekning nr} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\

    \hhline{*{9}{=::}=}
    \textbf{\begin{tabular}[c]{@{}l@{}}Peksekvens\\ Försöksdeltagare\end{tabular}}
      & A & B & G & D & E & F & C & H & I \\
    \hhline{*{9}{-||}-}

  \end{tabular}
\end{table}
```

Upvotes: 0

Views: 738

Answers (1)

Marius Barth
Marius Barth

Reputation: 646

You can set

documentclass: "apa7"

in your YAML front matter. It should do the trick for your example. If you do so, you can also omit loading the caption package in your LaTeX header.

However, please note that full support of the apa7 document class is still somewhat limited. Here you can find further information on how to get as close as possible to APA7.

Upvotes: 1

Related Questions