Merge branch 'master' of https://github.com/haozhu233/kableExtra
diff --git a/R/kable_styling.R b/R/kable_styling.R
index b7a343b..0a43f74 100644
--- a/R/kable_styling.R
+++ b/R/kable_styling.R
@@ -35,19 +35,18 @@
#' a `LaTeX` table, if `float_*` is selected, `LaTeX` package `wrapfig` will be
#' imported.
#' @param font_size A numeric input for table font size
-#' @param row_label_position A character string determining the justification of the row
-#' labels in a table. Possible values inclued `l` for left, `c` for center, and `r` for
-#' right. The default value is `l` for left justifcation.
-#' @param ... extra options for HTML or LaTeX. See `details`.
-#'
-#' @details For LaTeX, extra options includes:
-#' - `repeat_header_method` can either be `append`(default) or `replace`
-#' - `repeat_header_text` is just a text string you want to append on or
-#' replace the caption.
-#' - `stripe_color` allows users to pick a different color for their strip lines.
-#' - `latex_table_env` character string to define customized table environment
-#' such as tabu or tabularx.You shouldn't expect all features could be
-#' supported in self-defined environments.
+#' @param row_label_position A character string determining the justification
+#' of the row labels in a table. Possible values inclued `l` for left, `c` for
+#' center, and `r` for right. The default value is `l` for left justifcation.
+#' @param repeat_header_method LaTeX option, can either be `append`(default) or
+#' `replace`
+#' @param repeat_header_text LaTeX option. A text string you want to append on
+#' or replace the caption.
+#' @param stripe_color LaTeX option allowing users to pick a different color
+#' for their strip lines. This option is not available in HTML
+#' @param latex_table_env LaTeX option. A character string to define customized
+#' table environment such as tabu or tabularx.You shouldn't expect all features
+#' could be supported in self-defined environments.
#'
#' @details For LaTeX, if you use other than English environment
#' - all tables are converted to 'UTF-8'. If you use, for example, Hungarian
@@ -68,7 +67,11 @@
position = "center",
font_size = NULL,
row_label_position = "l",
- ...) {
+ repeat_header_text = "\\textit{(continued)}",
+ repeat_header_method = c("append", "replace"),
+ repeat_header_continued = FALSE,
+ stripe_color = "gray!6",
+ latex_table_env = NULL) {
if (length(bootstrap_options) == 1 && bootstrap_options == "basic") {
bootstrap_options <- getOption("kable_styling_bootstrap_options", "basic")
@@ -97,26 +100,28 @@
if (is.null(full_width)) {
full_width <- getOption("kable_styling_full_width", T)
}
- if(!missing(row_label_position)) {
- warning("'row_label_position' is not active for HTML tables yet and parameter will not be used.")
- }
return(htmlTable_styling(kable_input,
bootstrap_options = bootstrap_options,
full_width = full_width,
position = position,
- font_size = font_size, ...))
+ font_size = font_size))
}
if (kable_format == "latex") {
if (is.null(full_width)) {
full_width <- getOption("kable_styling_full_width", F)
}
+ repeat_header_method <- match.arg(repeat_header_method)
return(pdfTable_styling(kable_input,
latex_options = latex_options,
full_width = full_width,
position = position,
font_size = font_size,
row_label_position = row_label_position,
- ...))
+ repeat_header_text = repeat_header_text,
+ repeat_header_method = repeat_header_method,
+ repeat_header_continued = repeat_header_continued,
+ stripe_color = stripe_color,
+ latex_table_env = latex_table_env))
}
}
@@ -189,19 +194,18 @@
return(out)
}
-# LaTeX table style
+# LaTeX table style ------------
pdfTable_styling <- function(kable_input,
latex_options = "basic",
- full_width = F,
- position = c("center", "left", "right",
- "float_left", "float_right"),
- font_size = NULL,
- repeat_header_text = "\\textit{(continued)}",
- repeat_header_method = c("append", "replace"),
- repeat_header_continued = FALSE,
- stripe_color = "gray!6",
- latex_table_env = NULL,
- row_label_position) {
+ full_width = FALSE,
+ position,
+ font_size,
+ row_label_position,
+ repeat_header_text,
+ repeat_header_method,
+ repeat_header_continued,
+ stripe_color,
+ latex_table_env) {
latex_options <- match.arg(
latex_options,
@@ -209,8 +213,6 @@
several.ok = T
)
- repeat_header_method <- match.arg(repeat_header_method)
-
out <- NULL
out <- solve_enc(kable_input)
@@ -260,14 +262,13 @@
table_info$end_tabular)
}
- position <- match.arg(position)
out <- styling_latex_position(out, table_info, position, latex_options)
out <- structure(out, format = "latex", class = "knitr_kable")
attr(out, "kable_meta") <- table_info
if (row_label_position != "l") {
- if(table_info$tabular=="longtable") {
+ if (table_info$tabular == "longtable") {
out <- sub("\\\\begin\\{longtable\\}\\{l",
paste0("\\\\begin\\{longtable\\}\\{",
row_label_position),