remove add_header_left entirely
update rd files
improve package documentation based on @wibeasley's suggestion
diff --git a/DESCRIPTION b/DESCRIPTION
index b8e17b7..4d9a369 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -33,3 +33,4 @@
testthat
VignetteBuilder: knitr
RoxygenNote: 6.0.1
+Roxygen: list(markdown = TRUE)
diff --git a/R/add_header_left.R b/R/add_header_left.R
deleted file mode 100644
index 25012af..0000000
--- a/R/add_header_left.R
+++ /dev/null
@@ -1,246 +0,0 @@
-#' Add a heading column to the left side of the table
-#'
-#' @description This function uses the same syntax as add_header_above. It will
-#' add a heading column with grouped rows to the left side of the table. It can
-#' act as an alternative way to `group_rows` to show grouped information. As
-#' `add_header_above`, users can use this function to add multiple layers of
-#' heading columns one by one.
-#'
-#' @param kable_input Output of `knitr::kable()` with `format` specified
-#' @param header A (named) character vector with `rowspan` as values. For
-#' example, `c("xxx" = 1, "title" = 2)` can be used to create a new header column
-#' for a 3-row table with "xxx" spanning row 1 and "title" spanning row 2 & 3 (
-#' two rows). For convenience, when `rowspan` equals to 1, users can drop the
-#' ` = 1` part. As a result, `c("xxx", "title" = 2)` is the same as
-#' `c("xxx" = 1, "title" = 2)`.
-#' @param header_name Column name that that extra column
-#' @param width A character string for the width of the new column. Values
-#' could be "10cm", "3in" or "30em", etc..
-#' @param align Column alignment. you can choose from "c", "l" or "r"
-#' @param bold A T/F value to control whether the text should be bolded.
-#' @param italic A T/F value to control whether the text should to be emphasized.
-#' @param ... Extra options to be passed into HTML or LaTeX. Right now there is
-#' only one for LaTeX. Option full_midline is a TRUE/FALSE option to control
-#' if the mid line needs to be extended to the end of row.
-#'
-#' @examples x <- knitr::kable(head(mtcars), "html")
-#' add_header_left(x, c("A" = 2, "B" = 2, "C" = 2))
-add_header_left <- function(kable_input, header = NULL, header_name = "",
- align = "c", width = NULL, bold = F, italic = F,
- ...) {
- if (is.null(header)) return(kable_input)
- kable_format <- attr(kable_input, "format")
- if (!kable_format %in% c("html", "latex")) {
- stop("Please specify output format in your kable function. Currently ",
- "generic markdown table using pandoc is not supported.")
- }
- if (kable_format == "html") {
- return(add_header_left_html(kable_input, header, header_name, align,
- width, bold, italic))
- }
- if (kable_format == "latex") {
- return(add_header_left_latex(kable_input, header, header_name, align,
- width, bold, italic, ...))
- }
-}
-
-# HTML
-add_header_left_html <- function(kable_input, header, header_name, align,
- width, bold, italic) {
- kable_attrs <- attributes(kable_input)
- kable_xml <- read_xml(as.character(kable_input), options = "COMPACT")
- kable_thead <- xml_tpart(kable_xml, "thead")
- kable_tbody <- xml_tpart(kable_xml, "tbody")
-
- align <- match.arg(align, c("c", "l", "r"))
- align <- switch(align, "c" = "center", "l" = "left", "r" = "right")
-
- column_style <- paste0(
- ifelse(!is.null(width), paste0("width: ", width, "; "), ""),
- ifelse(bold, "font-weight: bold; ", ""),
- ifelse(italic, "font-style: italic; ", "")
- )
-
- new_header <- paste0(
- '<th style="text-align:', align, '; vertical-align: bottom;', column_style,
- '" rowspan="', length(xml_children(kable_thead)), '">', header_name, '</th>'
- )
- new_header <- read_xml(new_header, options = c("COMPACT"))
- xml_add_child(xml_child(kable_thead, 1), new_header, .where = 0)
-
- header <- standardize_header(header, length(xml_children(kable_tbody)))
- for (i in 1:nrow(header)) {
- new_row_item <- paste0(
- '<td style="text-align:', align, '; vertical-align: middle;',
- column_style, '" rowspan="',
- header$rowspan[i], '">', header$header[i], '</td>')
- new_row_item <- read_xml(new_row_item, options = "COMPACT")
- target_row <- xml_child(kable_tbody, header$row[i])
- xml_add_child(target_row, new_row_item, .where = 0)
- }
-
- out <- structure(as.character(kable_xml), format = "html",
- class = "knitr_kable")
-
- # Adjust for column_spec
- if (is.null(kable_attrs$column_adjust)) {
- table_nrow <- length(xml_children(kable_tbody))
- # if (!is.null(kable_attrs$group_header_rows)) {
- # table_nrow <- table_nrow - length(kable_attrs$group_header_rows)
- # }
- table_ncol <- length(xml_children(
- xml_child(kable_thead, length(xml_children(kable_thead)))
- ))
- kable_attrs$column_adjust$matrix <- matrix(
- rep(TRUE, table_nrow * table_ncol), ncol = table_nrow)
- kable_attrs$column_adjust$count <- 1
- new_row_index <- rep(FALSE, table_nrow)
- } else {
- new_row_index <- rep(FALSE, ncol(kable_attrs$column_adjust$matrix))
- kable_attrs$column_adjust$count <- 1 + kable_attrs$column_adjust$count
- }
- new_row_index[header$row] <- TRUE
- kable_attrs$column_adjust$matrix <- rbind(
- new_row_index, kable_attrs$column_adjust$matrix
- )
- attributes(out) <- kable_attrs
-
- return(out)
-}
-
-standardize_header <- function(header, n_row) {
- header_names <- names(header)
-
- if (is.null(header_names)) {
- return(data.frame(header = header, row = 1:length(header),
- rowspan = 1, row.names = NULL))
- }
-
- names(header)[header_names == ""] <- header[header_names == ""]
- header[header_names == ""] <- 1
- header_names <- names(header)
- header <- as.numeric(header)
- names(header) <- header_names
- if (sum(header) < n_row) {
- header <- c(header, " " = n_row - sum(header))
- }
- row_pos <- c(1, cumsum(header)[-length(header)] + 1)
- return(data.frame(
- header = names(header),
- row = row_pos, rowspan = header, row.names = NULL
- ))
-}
-
-add_header_left_latex <- function(kable_input, header, header_name, align,
- width, bold, italic, full_midline = F) {
- table_info <- magic_mirror(kable_input)
- usepackage_latex("multirow")
- if (!table_info$booktabs) {
- warning("add_header_left only supports LaTeX table with booktabs. Please",
- " use kable(..., booktabs = T) in your kable function.")
- }
- out <- as.character(kable_input)
- contents <- table_info$contents
- header_name <- escape_latex(header_name)
- header <- standardize_header(header, length(contents) - 1)
- header$header <- escape_latex(header$header)
- header$header <- gsub("\\\\", "\\\\\\\\", header$header)
- header$row <- header$row + 1
- header$row_end <- header$row + header$rowspan - 1
-
- # Align
- align_row <- latex_column_align_builder(align, width, bold, italic)
-
- out <- sub(paste0(table_info$begin_tabular, "\\{"),
- paste0(table_info$begin_tabular, "{", align_row,
- ifelse(table_info$booktabs, "", "|")),
- out, perl = T)
- # table_info$align_vector <- c(align, table_info$align_vector)
-
- # Header
- ## Extra header rows introduced by add_header_above
- if (!is.null(table_info$new_header_row)) {
- new_header_row <- table_info$new_header_row
- for (i in 1:length(new_header_row)) {
- out <- sub(regex_escape(new_header_row[i]),
- paste0(" & ", new_header_row[i]), out)
- cline_old <- cline_gen(table_info$header_df[[i]], table_info$booktabs)
- cline_old <- regex_escape(cline_old)
- table_info$header_df[[i]] <- rbind(
- data.frame(header = " ", colspan = 1),
- table_info$header_df[[i]]
- )
- cline_new <- cline_gen(table_info$header_df[[i]], table_info$booktabs)
- out <- sub(cline_old, cline_new, out)
- }
- }
- ## Base Header row
- out <- sub(contents[1], paste0(header_name, " & ", contents[1]), out)
- table_info$contents[1] <- paste0(header_name, " & ", contents[1])
-
- # move existing midrules if exists
- out_lines <- read_lines(out)
- tbody_start_row <- which(out_lines == "\\midrule")
- tbody_end_row <- which(out_lines == "\\bottomrule")
- before_tbody <- out_lines[seq(1, tbody_start_row)]
- tbody <- out_lines[seq(tbody_start_row + 1, tbody_end_row - 1)]
- after_tbody <- out_lines[seq(tbody_end_row, length(out_lines))]
-
- # Remove addlinespace in this case
- tbody <- tbody[tbody != "\\addlinespace"]
-
- midrule_exist <- str_sub(tbody, 1, 9) == "\\cmidrule"
- if (sum(midrule_exist) > 0) {
- existing_midrules <- which(midrule_exist)
- tbody[existing_midrules] <- unlist(lapply(
- tbody[existing_midrules], cmidrule_plus_one
- ))
- out <- paste0(c(before_tbody, tbody, after_tbody), collapse = "\n")
- }
-
- for (j in 1:nrow(header)) {
- new_row_pre <- paste0(
- "\\\\multirow\\{", -header$rowspan[j], "\\}\\{",
- ifelse(is.null(width), "\\*", width),
- "\\}\\{",
- switch(align,
- "l" = "\\\\raggedright\\\\arraybackslash ",
- "c" = "\\\\centering\\\\arraybackslash ",
- "r" = "\\\\raggedleft\\\\arraybackslash "),
- header$header[j], "\\} & "
- )
- new_row_text <- paste0(new_row_pre, contents[header$row_end[j]])
- out <- sub(contents[header$row_end[j]], new_row_text, out)
- table_info$contents[header$row_end[j]] <- new_row_text
- if (j != nrow(header)) {
- out <- sub(
- paste0(contents[header$row_end[j]], "\\\\\\\\\n"),
- paste0(contents[header$row_end[j]],
- "\\\\\\\\\n\\\\cmidrule[0.5pt](l{2pt}r{2pt}){1-",
- ifelse(full_midline, str_count(tbody[1], " & ") + 2, 1),
- "}\n"),
- out
- )
- }
- }
-
- for (k in setdiff(seq(2, length(contents)), header$row_end)) {
- out <- sub(contents[k],
- paste0(" & ", contents[k]),
- out)
- table_info$contents[k] <- paste0(" & ", contents[k])
- }
-
- out <- structure(out, format = "latex", class = "knitr_kable")
-
- attr(out, "kable_meta") <- table_info
- return(out)
-}
-
-cmidrule_plus_one <- function(x) {
- start_pos <- as.numeric(str_match(x, "\\)\\{(.*)-")[2]) + 1
- stop_pos <- as.numeric(str_match(x, "-(.*)\\}")[2]) + 1
- return(
- paste0("\\cmidrule[0.5pt](l{2pt}r{2pt}){", start_pos, "-", stop_pos, "}")
- )
-}
diff --git a/R/kableExtra-package.R b/R/kableExtra-package.R
index b0674be..a690e84 100644
--- a/R/kableExtra-package.R
+++ b/R/kableExtra-package.R
@@ -1,5 +1,56 @@
#' kableExtra
#'
+#' @description When we are talking about table generators in R,
+#' [knitr](https://yihui.name/knitr/)'s `kable()` function wins lots of flavor
+#' by its ultimate simplicity. Unlike those powerful table rendering engines
+#' such as [`xtable`](https://CRAN.R-project.org/package=xtable), the philosophy
+#' behind [`knitr::kable()`](https://rdrr.io/cran/knitr/man/kable.html) is to
+#' make it easy for programmers to use. Just as it claimed in its
+#' function description, "this is a very simple table generator. It is simple
+#' by design. It is not intended to replace any other R packages for making
+#' tables. - Yihui".
+#'
+#' However, the ultimate simplicity of `kable()` also brought troubles to some
+#' of us, especially for new R users, who may not have a lot of experience on
+#' generating tables in R. It is not rare to see people including experienced
+#' users asking questions like how to center/left-align a table on Stack
+#' Overflow. Also, for me personally, I found myself repeatedly parsing CSS
+#' into `kable()` for some very simple features like striped lines. For LaTeX,
+#' it's even worse since I'm almost Stack Overflow dependent for LaTeX...
+#' That's why this package `kableExtra` was created.
+#'
+#' I hope with `kableExtra`, you can
+#' - Use default base `kable()` (Or a good alternative for markdown tables is
+#' `pander::pander()`) for all simple tables
+#' - Use `kable()` with `kableExtra` to generate 90 % of complex/advanced
+#' tables in either HTML or LaTeX
+#' - Only have to mess with raw HTML/LaTeX in the last 10% cases where
+#' `kableExtra` cannot solve the problem
+#'
+#' @section Features:
+#' **Pipable syntax:** `kableExtra` is NOT a table generating package. It is a
+#' package that can "add features" to a `kable` output using a syntax
+#' that every useR loves - the [pipe](http://r4ds.had.co.nz/pipes.html).
+#' We see similar approaches to deal with plots in packages like `ggvis` and
+#' `plotly`. There is no reason why we cannot use it with tables.
+#'
+#' **Unified functions for both HTML and PDF:** Most functionalities in
+#' `kableExtra` can work in both HTML and PDF. In fact, as long as you
+#' specifies format in `kable` (which can be set globally through option
+#' `knitr.table.format`), functions in this package will pick the right way
+#' to manipulate the table be themselves. As a result, if users want to left
+#' align the table, `kable_styling(kable(...), position = "left")` will work
+#' in both HTML and PDF.
+#'
+#' @note If you found a feature on the documentation site that is not available
+#' in the version of `kableExtra` you are using, try to install the pre-release
+#' version from github. You can do so by running
+#' `devtools::install_github("haozhu233/kableExtra")`.
+#'
+#' Also, note that This package can load required LaTeX package automatically in
+#' vanilla rmarkdown. For customized rmarkdown templates, it is recommended to
+#' load related LaTeX packages manually.
+#'
#' @importFrom stringr str_count str_split str_match str_detect str_match_all
#' str_extract str_replace_all str_trim str_extract_all str_sub
#' @importFrom xml2 read_xml xml_attr xml_has_attr xml_attr<- read_html
diff --git a/inst/NEWS b/inst/NEWS
index 0afdbfa..25b31c4 100644
--- a/inst/NEWS
+++ b/inst/NEWS
@@ -14,13 +14,14 @@
* Fixed a bug in add_header_above to allow special symbol in extra header rows.
-* Added add_header_left() feature so people can insert heading columns as they
-do for heading rows.
-
-* Added alignment feature to column_spec when width is specified.
+* Allow column_spec automatically align when width is specified.
* Added bold/italic options to add_header_above.
+* Added `collapse_rows` to collapse repeated rows to multirow cell
+
+* Improve package-level documentation based on @wibeasley's suggestion
+
kableExtra 0.2.1
--------------------------------------------------------------------------------
diff --git a/man/add_footnote.Rd b/man/add_footnote.Rd
index d3839a3..5bab0eb 100644
--- a/man/add_footnote.Rd
+++ b/man/add_footnote.Rd
@@ -15,7 +15,7 @@
notations in your notes.}
\item{notation}{You can select the format of your footnote notation from
-`number`, `alphabet` and `symbol`.}
+\code{number}, \code{alphabet} and \code{symbol}.}
\item{threeparttable}{Boolean value indicating if a
\href{https://www.ctan.org/pkg/threeparttable}{threeparttable} scheme should
diff --git a/man/add_header_above.Rd b/man/add_header_above.Rd
index cbe6988..d879bc7 100644
--- a/man/add_header_above.Rd
+++ b/man/add_header_above.Rd
@@ -7,13 +7,13 @@
add_header_above(kable_input, header = NULL, bold = F, italic = F)
}
\arguments{
-\item{kable_input}{Output of `knitr::kable()` with `format` specified}
+\item{kable_input}{Output of \code{knitr::kable()} with \code{format} specified}
-\item{header}{A (named) character vector with `colspan` as values. For
-example, `c(" " = 1, "title" = 2)` can be used to create a new header row
+\item{header}{A (named) character vector with \code{colspan} as values. For
+example, \code{c(" " = 1, "title" = 2)} can be used to create a new header row
for a 3-column table with "title" spanning across column 2 and 3. For
-convenience, when `colspan` equals to 1, users can drop the ` = 1` part.
-As a result, `c(" ", "title" = 2)` is the same as `c(" " = 1, "title" = 2)`.}
+convenience, when \code{colspan} equals to 1, users can drop the \code{= 1} part.
+As a result, \code{c(" ", "title" = 2)} is the same as \code{c(" " = 1, "title" = 2)}.}
\item{bold}{A T/F value to control whether the text should be bolded.}
@@ -21,9 +21,9 @@
}
\description{
Tables with multiple rows of header rows are extremely useful
-to demonstrate grouped data. This function takes the output of a `kable()`
+to demonstrate grouped data. This function takes the output of a \code{kable()}
function and adds an header row on top of it. This function can work with
-both `HTML` and `LaTeX` outputs
+both \code{HTML} and \code{LaTeX} outputs
}
\examples{
x <- knitr::kable(head(mtcars), "html")
diff --git a/man/add_header_left.Rd b/man/add_header_left.Rd
deleted file mode 100644
index 43094a6..0000000
--- a/man/add_header_left.Rd
+++ /dev/null
@@ -1,45 +0,0 @@
-% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/add_header_left.R
-\name{add_header_left}
-\alias{add_header_left}
-\title{Add a heading column to the left side of the table}
-\usage{
-add_header_left(kable_input, header = NULL, header_name = "", align = "c",
- width = NULL, bold = F, italic = F, ...)
-}
-\arguments{
-\item{kable_input}{Output of `knitr::kable()` with `format` specified}
-
-\item{header}{A (named) character vector with `rowspan` as values. For
-example, `c("xxx" = 1, "title" = 2)` can be used to create a new header column
-for a 3-row table with "xxx" spanning row 1 and "title" spanning row 2 & 3 (
-two rows). For convenience, when `rowspan` equals to 1, users can drop the
-` = 1` part. As a result, `c("xxx", "title" = 2)` is the same as
-`c("xxx" = 1, "title" = 2)`.}
-
-\item{header_name}{Column name that that extra column}
-
-\item{align}{Column alignment. you can choose from "c", "l" or "r"}
-
-\item{width}{A character string for the width of the new column. Values
-could be "10cm", "3in" or "30em", etc..}
-
-\item{bold}{A T/F value to control whether the text should be bolded.}
-
-\item{italic}{A T/F value to control whether the text should to be emphasized.}
-
-\item{...}{Extra options to be passed into HTML or LaTeX. Right now there is
-only one for LaTeX. Option full_midline is a TRUE/FALSE option to control
-if the mid line needs to be extended to the end of row.}
-}
-\description{
-This function uses the same syntax as add_header_above. It will
-add a heading column with grouped rows to the left side of the table. It can
-act as an alternative way to `group_rows` to show grouped information. As
-`add_header_above`, users can use this function to add multiple layers of
-heading columns one by one.
-}
-\examples{
-x <- knitr::kable(head(mtcars), "html")
-add_header_left(x, c("A" = 2, "B" = 2, "C" = 2))
-}
diff --git a/man/add_indent.Rd b/man/add_indent.Rd
index e141e70..439fd29 100644
--- a/man/add_indent.Rd
+++ b/man/add_indent.Rd
@@ -7,7 +7,7 @@
add_indent(kable_input, positions)
}
\arguments{
-\item{kable_input}{Output of `knitr::kable()` with `format` specified}
+\item{kable_input}{Output of \code{knitr::kable()} with \code{format} specified}
\item{positions}{A vector of numeric row numbers for the rows that need to
be indented.}
diff --git a/man/collapse_rows.Rd b/man/collapse_rows.Rd
index 49deb7f..e1078a3 100644
--- a/man/collapse_rows.Rd
+++ b/man/collapse_rows.Rd
@@ -7,16 +7,16 @@
collapse_rows(kable_input, columns = NULL)
}
\arguments{
-\item{kable_input}{Output of `knitr::kable()` with `format` specified}
+\item{kable_input}{Output of \code{knitr::kable()} with \code{format} specified}
\item{columns}{Numeric column positions where rows need to be collapsed.}
}
\description{
Collapse same values in columns into multirow cells. This
-feature does similar things with `group_rows`. However, unlike `group_rows`,
+feature does similar things with \code{group_rows}. However, unlike \code{group_rows},
it analyzes existing columns, finds out rows that can be grouped together,
-and make them multirow cells. Note that if you want to use `column_spec` to
-specify column styles, you should use `column_spec` before `collapse_rows`.
+and make them multirow cells. Note that if you want to use \code{column_spec} to
+specify column styles, you should use \code{column_spec} before \code{collapse_rows}.
}
\examples{
dt <- data.frame(a = c(1, 1, 2, 2), b = c("a", "a", "a", "b"))
diff --git a/man/column_spec.Rd b/man/column_spec.Rd
index cf4b5cf..fdedeac 100644
--- a/man/column_spec.Rd
+++ b/man/column_spec.Rd
@@ -8,7 +8,7 @@
italic = FALSE)
}
\arguments{
-\item{kable_input}{Output of `knitr::kable()` with `format` specified}
+\item{kable_input}{Output of \code{knitr::kable()} with \code{format} specified}
\item{column}{A numeric value indicating which column to be selected. When
you do the counting, ignore the extra header columns you added through
diff --git a/man/group_rows.Rd b/man/group_rows.Rd
index 6cf58ee..8275309 100644
--- a/man/group_rows.Rd
+++ b/man/group_rows.Rd
@@ -8,7 +8,7 @@
label_row_css = "border-bottom: 1px solid;", latex_gap_space = "0.5em")
}
\arguments{
-\item{kable_input}{Output of `knitr::kable()` with `format` specified}
+\item{kable_input}{Output of \code{knitr::kable()} with \code{format} specified}
\item{group_label}{A character string for the name of the group}
diff --git a/man/kableExtra-package.Rd b/man/kableExtra-package.Rd
index 3de7e0f..33854bc 100644
--- a/man/kableExtra-package.Rd
+++ b/man/kableExtra-package.Rd
@@ -6,6 +6,60 @@
\alias{kableExtra}
\title{kableExtra}
\description{
-kableExtra
+When we are talking about table generators in R,
+\href{https://yihui.name/knitr/}{knitr}'s \code{kable()} function wins lots of flavor
+by its ultimate simplicity. Unlike those powerful table rendering engines
+such as \href{https://CRAN.R-project.org/package=xtable}{xtable}, the philosophy
+behind \href{https://rdrr.io/cran/knitr/man/kable.html}{knitr::kable()} is to
+make it easy for programmers to use. Just as it claimed in its
+function description, "this is a very simple table generator. It is simple
+by design. It is not intended to replace any other R packages for making
+tables. - Yihui".
+
+However, the ultimate simplicity of \code{kable()} also brought troubles to some
+of us, especially for new R users, who may not have a lot of experience on
+generating tables in R. It is not rare to see people including experienced
+users asking questions like how to center/left-align a table on Stack
+Overflow. Also, for me personally, I found myself repeatedly parsing CSS
+into \code{kable()} for some very simple features like striped lines. For LaTeX,
+it's even worse since I'm almost Stack Overflow dependent for LaTeX...
+That's why this package \code{kableExtra} was created.
+
+I hope with \code{kableExtra}, you can
+\itemize{
+\item Use default base \code{kable()} (Or a good alternative for markdown tables is
+\code{pander::pander()}) for all simple tables
+\item Use \code{kable()} with \code{kableExtra} to generate 90 % of complex/advanced
+tables in either HTML or LaTeX
+\item Only have to mess with raw HTML/LaTeX in the last 10% cases where
+\code{kableExtra} cannot solve the problem
}
+}
+\note{
+If you found a feature on the documentation site that is not available
+in the version of \code{kableExtra} you are using, try to install the pre-release
+version from github. You can do so by running
+\code{devtools::install_github("haozhu233/kableExtra")}.
+
+Also, note that This package can load required LaTeX package automatically in
+vanilla rmarkdown. For customized rmarkdown templates, it is recommended to
+load related LaTeX packages manually.
+}
+\section{Features}{
+
+\strong{Pipable syntax:} \code{kableExtra} is NOT a table generating package. It is a
+package that can "add features" to a \code{kable} output using a syntax
+that every useR loves - the \href{http://r4ds.had.co.nz/pipes.html}{pipe}.
+We see similar approaches to deal with plots in packages like \code{ggvis} and
+\code{plotly}. There is no reason why we cannot use it with tables.
+
+\strong{Unified functions for both HTML and PDF:} Most functionalities in
+\code{kableExtra} can work in both HTML and PDF. In fact, as long as you
+specifies format in \code{kable} (which can be set globally through option
+\code{knitr.table.format}), functions in this package will pick the right way
+to manipulate the table be themselves. As a result, if users want to left
+align the table, \code{kable_styling(kable(...), position = "left")} will work
+in both HTML and PDF.
+}
+
\keyword{package}
diff --git a/man/kable_styling.Rd b/man/kable_styling.Rd
index a491d31..52080ae 100644
--- a/man/kable_styling.Rd
+++ b/man/kable_styling.Rd
@@ -9,37 +9,37 @@
font_size = NULL, ...)
}
\arguments{
-\item{kable_input}{Output of `knitr::kable()` with `format` specified}
+\item{kable_input}{Output of \code{knitr::kable()} with \code{format} specified}
\item{bootstrap_options}{A character vector for bootstrap table options.
Please see package vignette or visit the w3schools'
\href{https://www.w3schools.com/bootstrap/bootstrap_tables.asp}{Bootstrap Page}
-for more information. Possible options include `basic`, `striped`,
-`bordered`, `hover`, `condensed` and `responsive`.}
+for more information. Possible options include \code{basic}, \code{striped},
+\code{bordered}, \code{hover}, \code{condensed} and \code{responsive}.}
\item{latex_options}{A character vector for LaTeX table options. Please see
package vignette for more information. Possible options include
-`basic`, `striped`, `hold_position`, `scale_down` & `repeat_header`.
-`striped` will add alternative row colors to the table. It will imports
-`LaTeX` package `xcolor` if enabled. `hold_position` will "hold" the floating
-table to the exact position. It is useful when the `LaTeX` table is contained
- in a `table` environment after you specified captions in `kable()`. It will
- force the table to stay in the position where it was created in the document.
-`scale_down` is useful for super wide table. It will automatically adjust
-the table to page width. `repeat_header` in only meaningful in a longtable
+\code{basic}, \code{striped}, \code{hold_position}, \code{scale_down} & \code{repeat_header}.
+\code{striped} will add alternative row colors to the table. It will imports
+\code{LaTeX} package \code{xcolor} if enabled. \code{hold_position} will "hold" the floating
+table to the exact position. It is useful when the \code{LaTeX} table is contained
+in a \code{table} environment after you specified captions in \code{kable()}. It will
+force the table to stay in the position where it was created in the document.
+\code{scale_down} is useful for super wide table. It will automatically adjust
+the table to page width. \code{repeat_header} in only meaningful in a longtable
environment. It will let the header row repeat on every page in that long
table.}
-\item{full_width}{A `TRUE` or `FALSE` variable controlling whether the HTML
+\item{full_width}{A \code{TRUE} or \code{FALSE} variable controlling whether the HTML
table should have 100\% width. Since HTML and pdf have different flavors on
-the preferable format for `full_width`. If not specified, a HTML table will
-have full width by default but this option will be set to `FALSE` for a
+the preferable format for \code{full_width}. If not specified, a HTML table will
+have full width by default but this option will be set to \code{FALSE} for a
LaTeX table}
\item{position}{A character string determining how to position the table
-on a page. Possible values include `left`, `center`, `right`, `float_left`
-and `float_right`. Please see the package doc site for demonstrations. For
-a `LaTeX` table, if `float_*` is selected, `LaTeX` package `wrapfig` will be
+on a page. Possible values include \code{left}, \code{center}, \code{right}, \code{float_left}
+and \code{float_right}. Please see the package doc site for demonstrations. For
+a \code{LaTeX} table, if \code{float_*} is selected, \code{LaTeX} package \code{wrapfig} will be
imported.}
\item{font_size}{A numeric input for table font size}
@@ -48,7 +48,7 @@
}
\description{
This function provides a cleaner approach to modify the style
-of HTML tables other than using the `table.attr` option in `knitr::kable()`.
+of HTML tables other than using the \code{table.attr} option in \code{knitr::kable()}.
Currenly, it assumes the HTML document has boot
}
\examples{
diff --git a/man/landscape.Rd b/man/landscape.Rd
index 793569b..3b99bf1 100644
--- a/man/landscape.Rd
+++ b/man/landscape.Rd
@@ -7,7 +7,7 @@
landscape(kable_input, margin = NULL)
}
\arguments{
-\item{kable_input}{Output of `knitr::kable()` with `format` specified}
+\item{kable_input}{Output of \code{knitr::kable()} with \code{format} specified}
\item{margin}{Customizable page margin for special needs. Values can be
"1cm", "1in" or similar.}
diff --git a/man/row_spec.Rd b/man/row_spec.Rd
index deb7912..d8237ad 100644
--- a/man/row_spec.Rd
+++ b/man/row_spec.Rd
@@ -7,7 +7,7 @@
row_spec(kable_input, row, bold = FALSE, italic = FALSE)
}
\arguments{
-\item{kable_input}{Output of `knitr::kable()` with `format` specified}
+\item{kable_input}{Output of \code{knitr::kable()} with \code{format} specified}
\item{row}{A numeric value indicating which row to be selected. You don't
need to count in header rows or group labeling rows.}
diff --git a/man/usepackage_latex.Rd b/man/usepackage_latex.Rd
index 62cabb8..ab2e09c 100644
--- a/man/usepackage_latex.Rd
+++ b/man/usepackage_latex.Rd
@@ -12,7 +12,7 @@
\item{options}{The LaTeX options for the package}
}
\description{
-Load a LaTeX package using R code. Just like `\\usepackage{}`
+Load a LaTeX package using R code. Just like \code{\\usepackage{}}
in LaTeX
}
\examples{