improve the way to change table environment in LaTeX
diff --git a/R/kable_styling.R b/R/kable_styling.R
index bbed083..41ba213 100644
--- a/R/kable_styling.R
+++ b/R/kable_styling.R
@@ -424,7 +424,18 @@
}
styling_latex_table_env <- function(x, current_env, latex_table_env) {
- return(gsub(paste0("\\{", current_env, "\\}"),
- paste0("\\{", latex_table_env, "\\}"), x))
+ x <- sub(
+ paste0("begin\\{", current_env, "\\}\\[t\\]"),
+ paste0("begin\\{", latex_table_env, "\\}"), x
+ )
+ x <- sub(
+ paste0("begin\\{", current_env, "\\}"),
+ paste0("begin\\{", latex_table_env, "\\}"), x
+ )
+ x <- sub(
+ paste0("end\\{", current_env, "\\}"),
+ paste0("end\\{", latex_table_env, "\\}"), x
+ )
+ return(x)
}