Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201894

Space between figure and caption RMarkdown PDF

$
0
0

I need to reduce the space between a caption and figure in my RMarkdown PDF document. I am using bookdown. Following the example here, I tried setting the length above and below the caption using the Latex command \setlength{}, but to no avail. MWE:

---
output:
  pdf_document: bookdown::pdf_document2
header-includes:
- \usepackage{floatrow}
- \floatsetup{capposition=top}
- \floatplacement{figure}{H}
- \captionsetup{position=above, aboveskip=0pt, belowskip=0pt}
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## Including Plots

\setlength{\abovecaptionskip}{-25pt plus 2pt minus 2pt}
\setlength{\belowcaptionskip}{-25pt plus 2pt minus 2pt}

```{r pressure, echo=FALSE, fig.cap = "Caption"}
plot(pressure)
```

Which yields:

enter image description here

Is there another way to get around this spacing issue?


Viewing all articles
Browse latest Browse all 201894

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>