rfontsr-flextable

Why does fontsize(size = 4, part = "all") not apply to the footnote of a flextable?


I had expected that the fontsize(size = 4, part = "all") would apply size = 4 on all parts of the table. It doesn't.

head(iris) %>%
  flextable() %>%
  fontsize(size = 4, part = "all") %>%
  footnote( i = 1, j = 1:2,
               value = as_paragraph(
                c("This is footnote one",
                   "This is footnote two")
               ),
               ref_symbols = c("a", "b"),
               part = "header") %>%
  footnote(i = 1, j = 3:4,
               value = as_paragraph(
                 c("This is footnote three",
                   "This is footnote four")
               ),
               ref_symbols = c("c","d"),
               part = "header")

enter image description here


Solution

  • Order matters - move fontsize() to after the creation of the footnotes:

    head(iris) %>%
      flextable() %>%
      footnote( i = 1, j = 1:2,
                value = as_paragraph(
                  c("This is footnote one",
                    "This is footnote two")
                ),
                ref_symbols = c("a", "b"),
                part = "header") %>%
      footnote(i = 1, j = 3:4,
               value = as_paragraph(
                 c("This is footnote three",
                   "This is footnote four")
               ),
               ref_symbols = c("c","d"),
               part = "header") %>%
      fontsize(size = 4, part = "all")
    

    enter image description here