Fixed a bug when row_spec and cell_spec used together
diff --git a/R/row_spec.R b/R/row_spec.R
index cc8978e..92d8150 100644
--- a/R/row_spec.R
+++ b/R/row_spec.R
@@ -249,9 +249,16 @@
}
if (!is.null(color)) {
new_row <- lapply(new_row, function(x) {
+ x <- clear_color_latex(x)
paste0("\\\\textcolor", latex_color(color), "\\{", x, "\\}")
})
}
+ if (!is.null(background)) {
+ new_row <- lapply(new_row, function(x) {
+ x <- clear_color_latex(x, background = TRUE)
+ paste0("\\\\cellcolor", latex_color(background), "\\{", x, "\\}")
+ })
+ }
if (!is.null(font_size)) {
new_row <- lapply(new_row, function(x) {
paste0("\\\\begingroup\\\\fontsize\\{", font_size, "\\}\\{",
@@ -284,9 +291,9 @@
new_row <- paste(unlist(new_row), collapse = " & ")
- if (!is.null(background)) {
- new_row <- paste0("\\\\rowcolor", latex_color(background), " ", new_row)
- }
+ # if (!is.null(background)) {
+ # new_row <- paste0("\\\\rowcolor", latex_color(background), " ", new_row)
+ # }
if (!hline_after & is.null(extra_latex_after)) {
return(new_row)
@@ -303,3 +310,5 @@
return(c(new_row, latex_after))
}
}
+
+