3

This is for Papaja. How do I get rid of figure captions at the bottom of the figure. My figure caption is quite long and I am going to a figure list. Now, I get both, and the figure caption runs out on the bottom of the page. Thanks, Jeff

Jeff
  • 31
  • 1

1 Answers1

1

There are currently two options to accomodate long figure captions or tall figures. You can adjust the line spacing/font size or, as you are doing, use a separate list of figure captions. I'll briefly explain both approaches.

1. List of figure captions

a) The LaTeX way

You can suppress the captions (defined by the chunk option fig.cap) below all figures by adding the following to the YAML front matter:

figurelist: yes

header-includes:
  - \captionsetup[figure]{textformat=empty}

b) The knitr way

If you would rather suppress figure captions only where necessary you can instead get knitr to do this.

Set the figure short caption via the chunk option fig.scap. To ensure that fig.scap takes effect, knitr requires that the chunk specifies out.width, out.height, or fig.align, as explained here. Remove the figure caption below the figure by setting fig.cap = " ".

Finally, I generally recommend to specify figure (and table) captions, especially long ones, using text references (e.g., (ref:reference-label). Taking all of this together, the following should do the trick:

(ref:figure-caption) This is a long figure caption!

```{r fig.cap = " ", fig.scap = "(ref:figure-caption)", out.width = "\\textwidth", fig.height = 7}
plot(cars)
```

Make sure that you include figurelist: yes in the YAML front matter and that you are using at least the development version of papaja with the commit hash d6227d8a750c6e67a323828a7cb0b8b8331aeac7, e.g. devtools::install_github("crsh/papaja@d6227d8a750c6e67a323828a7cb0b8b8331aeac7").

2. Adjust line spacing and font size

As mentioned in the manual, you can adjust the line spacing of figure captions. To additionally decrease the font size, add the following to the YAML front matter:

header-includes:
  - \usepackage{setspace}
  - \captionsetup[figure]{font={stretch=1,scriptsize}}

This should also make room for bigger captions or taller figures.

crsh
  • 1,699
  • 16
  • 33