I'm using flextable to loop over a list of data, generating captions and tables for each element in the list to generate tables in an rmarkdown document. While I can successfully render the captions and tables, the padding/margins between captions and tables is too large, and I can't find a way to reduce them. Here's what I have so far:
---
title: "Untitled"
output: html_document
date: '2022-05-09'
---
``{r setup, include=FALSE}
library(flextable)
library(magrittr)
``
``{r results='asis', echo=FALSE, ft.align="left"}
my_list<-list()
my_list$ds1<-head(mtcars, 5)
my_list$ds2<-head(mtcars, 10)
for (i in 1:length(my_list)) {
myft <- flextable(my_list[[i]]) %>%
set_caption(paste("Caption ", i))
flextable_to_rmd(myft)
}
``
I thought that perhaps using flextable::padding() would help, but this seems to only control the padding within the table rows, rather than the spacing between elements on a page.
Note that I've removed some of the required markdown backticks in the code sample above so that it can render correctly on Stackoverflow.

