Skip to content

Commit

Permalink
knitr latex
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Mar 5, 2024
1 parent aeeeacc commit 1dae8e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/factory_tinytable.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ factory_tinytable <- function(tab,
# html & latex get a new class to use print.modelsummary_string
if (settings_equal("output_format", c("latex", "typst", "html", "markdown"))) {
out <- tinytable::save_tt(out, output = settings_get("output_format"), overwrite = TRUE)
class(out) <- c("modelsummary_string", class(out))
class(out) <- c("knit_asis", "modelsummary_string", class(out))
}

return(invisible(out))
Expand Down
7 changes: 7 additions & 0 deletions R/sanitize_output.R
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ sanitize_output <- function(output) {
# choose factory based on output_format
output_factory <- factory_dict[[output_format]]

# appears to be needed otherwise not treated as_is in Quarto
if (output_factory == 'tinytable') {
if (isTRUE(check_dependency('knitr')) && knitr::is_latex_output()) {
output_format <- "latex"
}
}

# kableExtra must specify output_format ex ante (but after factory choice)
if (output_factory == 'kableExtra' && output_format %in% c('default', 'kableExtra')) {
if (isTRUE(check_dependency("knitr"))) {
Expand Down

0 comments on commit 1dae8e9

Please sign in to comment.