Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ErwinTATP opened this issue Apr 10, 2024 · 2 comments
Closed

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

ErwinTATP opened this issue Apr 10, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ErwinTATP
Copy link

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 ?

@atusy
Copy link
Owner

atusy commented Apr 11, 2024

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)

@atusy atusy added the bug Something isn't working label Apr 11, 2024
@ErwinTATP
Copy link
Author

The problem is solved. Thanks!

atusy added a commit that referenced this issue Apr 12, 2024
fix(as_paragraph_md): flextable's seq_index is renamed to .chunk_index (fixes #103)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants