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

pack_rows() with tabular = "tabularx" returns error #861

Closed
thmschk opened this issue Oct 6, 2024 · 3 comments
Closed

pack_rows() with tabular = "tabularx" returns error #861

thmschk opened this issue Oct 6, 2024 · 3 comments

Comments

@thmschk
Copy link

thmschk commented Oct 6, 2024

I am unable to use pack_rows() in combination with tabular = "tabularx", which produces an error.

library(kableExtra)
library(dplyr)
kbl(mtcars, format="latex", tabular = "tabularx", valign="{\\textwidth}") %>% kableExtra::pack_rows("XXX", 1,2)

# `error in seq.default(table_info$ncol) : 'from' must be a finite number`
@thmschk
Copy link
Author

thmschk commented Oct 6, 2024

I dived into the code a bit to understand the problem and guess that magic_mirror_latex() can't handle tabularx. As far as I can see, the ifelse condition might be extended to include tabularx:

table_info$tabular <- ifelse(grepl("\\\\begin\\{tabular\\}", kable_input), "tabular", ifelse(grepl("\\\\begin\\{tabularx\\}", kable_input), "tabularx", "longtable"))

@dmurdoch
Copy link
Collaborator

Fixed by #870.

@dmurdoch
Copy link
Collaborator

Thanks for the report and fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants