Hao Zhu | c1f3841 | 2017-02-23 12:13:48 -0500 | [diff] [blame] | 1 | .onLoad <- function(libname = find.package("kableExtra"), pkgname = "kableExtra") { |
Hao Zhu | 72917f9 | 2019-03-15 18:41:42 -0400 | [diff] [blame] | 2 | if (knitr::is_latex_output()) { |
| 3 | load_packages <- getOption("kableExtra.latex.load_packages", default = TRUE) |
| 4 | if (load_packages) { |
| 5 | usepackage_latex("booktabs") |
| 6 | usepackage_latex("longtable") |
| 7 | usepackage_latex("array") |
| 8 | usepackage_latex("multirow") |
| 9 | usepackage_latex("wrapfig") |
| 10 | usepackage_latex("float") |
| 11 | usepackage_latex("colortbl") |
| 12 | usepackage_latex("pdflscape") |
| 13 | usepackage_latex("tabu") |
| 14 | usepackage_latex("threeparttable") |
| 15 | usepackage_latex("threeparttablex") |
| 16 | usepackage_latex("ulem", "normalem") |
| 17 | usepackage_latex("makecell") |
Hao Zhu | b6b4f50 | 2020-10-22 12:16:03 -0400 | [diff] [blame] | 18 | usepackage_latex("xcolor") |
Hao Zhu | 72917f9 | 2019-03-15 18:41:42 -0400 | [diff] [blame] | 19 | } |
Hao Zhu | 6521605 | 2017-09-04 13:01:29 -0400 | [diff] [blame] | 20 | } |
Hao Zhu | c79d854 | 2020-08-18 03:19:21 -0400 | [diff] [blame] | 21 | auto_format <- getOption("kableExtra.auto_format", default = TRUE) |
| 22 | if (auto_format) auto_set_format() |
Hao Zhu | e5b9bff | 2018-05-20 17:40:03 -0400 | [diff] [blame] | 23 | if (!is.null(rmarkdown::metadata$output) && |
Marc Kupietz | 5cd02b3 | 2023-04-25 11:57:04 +0200 | [diff] [blame] | 24 | names(rmarkdown::metadata$output)[1] %in% c( |
Hao Zhu | 72917f9 | 2019-03-15 18:41:42 -0400 | [diff] [blame] | 25 | "ioslides_presentation", "slidy_presentation", |
Hao Zhu | e2ee69a | 2019-05-22 12:47:32 -0400 | [diff] [blame] | 26 | "gitbook", "bookdown::gitbook", "radix_article", "radix::radix_article", |
| 27 | "distill_article", "distill::distill_article" |
Hao Zhu | e5b9bff | 2018-05-20 17:40:03 -0400 | [diff] [blame] | 28 | )) { |
| 29 | options(kableExtra.html.bsTable = TRUE) |
| 30 | } |
Hao Zhu | c145088 | 2018-10-03 17:56:26 -0400 | [diff] [blame] | 31 | if (!is.null(knitr::opts_knit$get("rmarkdown.pandoc.to")) && |
| 32 | knitr::opts_knit$get("rmarkdown.pandoc.to") %in% c("epub3", "epub")) { |
| 33 | options(kableExtra.knit_print.dependency = FALSE) |
| 34 | } |
Hao Zhu | c1f3841 | 2017-02-23 12:13:48 -0500 | [diff] [blame] | 35 | } |