From 75152339a3510b89a33be244203232cb35b32754 Mon Sep 17 00:00:00 2001 From: Duncan Murdoch Date: Mon, 11 Dec 2023 08:27:15 -0500 Subject: [PATCH] keep entire line starting \begin{table}. Fixes #796. --- R/kable_styling.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/kable_styling.R b/R/kable_styling.R index 2ec6ab1..97073e5 100644 --- a/R/kable_styling.R +++ b/R/kable_styling.R @@ -566,8 +566,9 @@ styling_latex_position_center <- function(x, table_info, hold_position, } else if(hold_position == "HOLD_position") { x <- styling_latex_HOLD_position(x) } - } else if (table_info$table_env) - x <- sub("^\\\\begin\\{table}", "\\\\begin{table}\n\\\\centering", x) + } else if (table_info$table_env) { + x <- sub("^(\\\\begin\\{table}[^\n]*)\\n", "\\1\n\\\\centering", x) + } return(x) }