From ec9a036e53ca52e77fd97fb95bd6a19577663756 Mon Sep 17 00:00:00 2001 From: kellijohnson-NOAA Date: Thu, 10 Aug 2023 12:20:17 -0700 Subject: [PATCH] Actually fixes the label problem of #tab: I figured out that the weird label was only happening when we called sa4ss::es_table_tex from inside of an .Rmd file. The bookdown packages causes knitr to do weird things. I make R pretend that it is not in bookdown because we are saving all the files externally and then set the setting back to whatever it was using on.exit. So, @chantelwetzel-noaa i am not sure if you brought the other branch fix-escaping into your local branch but if you did you will want to undo that commit or rebase back to main because I am going to bring this change into main given it actually fixes the problem and does not mess up people's escaping. --- R/table_format.R | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/R/table_format.R b/R/table_format.R index a821feb..243ed15 100644 --- a/R/table_format.R +++ b/R/table_format.R @@ -73,6 +73,12 @@ table_format <- function(x, col_names <- kableExtra::linebreak(col_names, align = col_names_align) } + old_option <- knitr::opts_knit$get("bookdown.internal.label") + on.exit( + knitr::opts_knit$set(bookdown.internal.label = old_option), + add = TRUE + ) + knitr::opts_knit$set(bookdown.internal.label = FALSE) k <- kableExtra::kbl( x = x, format = format, @@ -88,6 +94,7 @@ table_format <- function(x, format.args = format.args, ... ) + suppressWarnings( k <- kableExtra::kable_styling( k,