added add_indent_latex
diff --git a/R/add_indent.R b/R/add_indent.R
new file mode 100644
index 0000000..c88b33d
--- /dev/null
+++ b/R/add_indent.R
@@ -0,0 +1,41 @@
+#' Add indentations to row headers
+#' @export
+add_indent <- function(kable_input, positions) {
+ kable_format <- attr(kable_input, "format")
+ if (!kable_format %in% c("html", "latex")) {
+ message("Currently generic markdown table using pandoc is not supported.")
+ return(kable_input)
+ }
+ if (kable_format == "html") {
+ return(kable_input)
+ }
+ if (kable_format == "latex") {
+ return(add_indent_latex(kable_input, positions))
+ }
+}
+
+add_indent_latex <- function(kable_input, positions) {
+ table_info <- attr(kable_input, "original_kable_meta")
+ if (is.null(table_info)) {
+ table_info <- magic_mirror(kable_input)
+ }
+
+ if (!is.numeric(positions)) {
+ stop("Positions can only take numeric row numbers (excluding header rows).")
+ }
+ if (max(positions) > table_info$nrow - 1) {
+ stop("There aren't that many rows in the table. Check positions in ",
+ "add_indent_latex.")
+ }
+
+ out <- kable_input
+ for (i in positions) {
+ rowtext <- table_info$contents[i + 1]
+ out <- sub(rowtext, latex_indent_unit(rowtext), out)
+ }
+ return(out)
+}
+
+latex_indent_unit <- function(rowtext) {
+ paste0("\\\\hspace{1em}", rowtext)
+}
diff --git a/R/landscape.R b/R/landscape.R
index 6f4049c..5727fe6 100644
--- a/R/landscape.R
+++ b/R/landscape.R
@@ -1,9 +1,7 @@
#' Print the table on an isolated landscape page in PDF
#'
-#' @description For very wide tables in PDF documents, sometimes it might be a
-#' good idea to have a single landscape page to house it. This function
-#' will rotate the PDF page for the applied table in LaTeX environment. It won't
-#' have any effects on HTML.
+#' @description This function will put the table on an single landscape page.
+#' It's useful for wide tables that cann't be printed on a portrait page.
#'
#' @param kable_input Output of `knitr::kable()` with `format` specified
#' @param margin Customizable page margin for special needs. Values can be