Skip to content

Commit

Permalink
Actually fixes the label problem of #tab:
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kellijohnson-NOAA committed Aug 10, 2023
1 parent e4ff71f commit ec9a036
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions R/table_format.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -88,6 +94,7 @@ table_format <- function(x,
format.args = format.args,
...
)

suppressWarnings(
k <- kableExtra::kable_styling(
k,
Expand Down

0 comments on commit ec9a036

Please sign in to comment.