davidgohel / flextable

table farming
https://ardata-fr.github.io/flextable-book/
565 stars 82 forks source link

Place footnotes only at end of flextable table over multiple pages, pdf output #601

Closed mdaviesgit closed 9 months ago

mdaviesgit commented 10 months ago

Flextable outputs in .docx documents, that exceed the space of a single page, automatically spread over multiple pages, and footnotes are only placed at the end of the table. However, for pdf outputs, the table will split over multiple pages, but the footnote appears on every page. For example:

---
output:
  bookdown::pdf_document2:
    latex_engine: xelatex
---

```{r table}
library(flextable)
library(dplyr)

flextable(iris)%>%
  add_footer_lines("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")


Would it be possible to add a command to "add_footer_lines" to specify that they should only appear at the bottom of the table, for pdf outputs.
davidgohel commented 10 months ago

yes, that's a good suggestion. It will probably an option of flextable::set_table_properties()

davidgohel commented 9 months ago

That was a nice suggestion, thanks.

Footer rows along pages in PDF are now deactivated by default. (It can be activated with command set_table_properties(opts_pdf = list(footer_repeat = TRUE)).)

---
output:
  bookdown::pdf_document2:
    latex_engine: xelatex
---

```{r table}
library(flextable)
library(dplyr)

flextable(iris)%>%
  set_table_properties(opts_pdf = list(footer_repeat = TRUE)) %>% 
  # set_table_properties(opts_pdf = list(footer_repeat = FALSE)) %>% # default option
  add_footer_lines("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")
github-actions[bot] commented 3 months ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.