fix a bug causing issues in tables' cran check
diff --git a/R/row_spec.R b/R/row_spec.R
index 3d08857..ea96971 100644
--- a/R/row_spec.R
+++ b/R/row_spec.R
@@ -203,14 +203,14 @@
hline_after, extra_latex_after)
temp_sub <- ifelse(i == 1 & (table_info$tabular == "longtable" |
!is.null(table_info$repeat_header_latex)),
- stringr::str_replace_all, stringr::str_replace)
+ gsub, sub)
if (length(new_row) == 1) {
- out <- temp_sub(out, paste0(target_row, "\\\\\\\\"),
- paste0(new_row, "\\\\\\\\"))
+ out <- temp_sub(paste0(target_row, "\\\\\\\\"),
+ paste0(new_row, "\\\\\\\\"), out, perl = T)
table_info$contents[i] <- new_row
} else {
- out <- temp_sub(out, paste0(target_row, "\\\\\\\\"),
- paste(new_row, collapse = ""))
+ out <- temp_sub(paste0(target_row, "\\\\\\\\"),
+ paste(new_row, collapse = ""), out, perl = T)
table_info$contents[i] <- new_row[1]
}
}
diff --git a/R/util.R b/R/util.R
index 785c6ad..474f352 100644
--- a/R/util.R
+++ b/R/util.R
@@ -110,7 +110,8 @@
"\\usepackage[normalem]{ulem}",
"\\usepackage[normalem]{ulem}",
"\\usepackage[utf8]{inputenc}",
- "\\usepackage{makecell}"
+ "\\usepackage{makecell}",
+ "\\usepackage{xcolor}"
))
}
diff --git a/R/zzz.R b/R/zzz.R
index 36133e7..c12793b 100644
--- a/R/zzz.R
+++ b/R/zzz.R
@@ -15,7 +15,7 @@
usepackage_latex("threeparttablex")
usepackage_latex("ulem", "normalem")
usepackage_latex("makecell")
- # usepackage_latex("xcolor")
+ usepackage_latex("xcolor")
}
}
auto_format <- getOption("kableExtra.auto_format", default = TRUE)