atusy/ftExtra

as_paragraph_md() not working in footnote() and set_caption()

Closed this issue · 2 comments

ftExtra 0.6.3, flextable 0.9.5.

Tested footnote() in the following code:

if (rmarkdown::pandoc_available("2.0.6")) {
  library(flextable)
  ft <- flextable(
    data.frame(
      x = c("**foo** bar", "***baz***", "*qux*"),
      stringsAsFactors = FALSE
    )
  ) %>%
    footnote(
      i = 1, j = 1,
      value = as_paragraph_md("**foot**"),
      ref_symbols = "*",
      part = "header", inline = TRUE
    )
}

result:

Error in match.names(clabs, names(xi)):
names do not match previous names

Then I tried to set_caption() with as_paragraph_md():

if (rmarkdown::pandoc_available("2.0.6")) {
  library(flextable)
  ft <- flextable(
    data.frame(
      x = c("**foo** bar", "***baz***", "*qux*"),
      stringsAsFactors = FALSE
    )
  ) %>%
    set_caption(
      caption = as_paragraph_md("cap~sub~^sup^cap"),
      style = "Table Caption"
    ) %>%
    ftExtra::colformat_md(
      part = "all"
    )
}

The result is all the subscripts and superscripts are clumped together:

image

I suppose this is related to the issue #100 ?

Thank you for the bug report.

#104 should fix the issue.
Could you try pak::pak("atusy/ftExtra#104") to install the patched version?

As you guessed, the problem comes from the change in the internal data structure of flextable, which is mentioned by David on #101 (comment)

The problem is solved. Thanks!