finishing kable_styling
diff --git a/.DS_Store b/.DS_Store
index 765c1e9..75c822a 100644
--- a/.DS_Store
+++ b/.DS_Store
Binary files differ
diff --git a/NAMESPACE b/NAMESPACE
index 18cab28..1adb487 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -13,6 +13,7 @@
 importFrom(rmarkdown,metadata)
 importFrom(rvest,html_table)
 importFrom(stringr,str_count)
+importFrom(stringr,str_split)
 importFrom(xml2,"xml_attr<-")
 importFrom(xml2,read_html)
 importFrom(xml2,read_xml)
diff --git a/R/footnote.R b/R/add_footnote.R
similarity index 95%
rename from R/footnote.R
rename to R/add_footnote.R
index 121066b..5db0778 100644
--- a/R/footnote.R
+++ b/R/add_footnote.R
@@ -28,14 +28,6 @@
   ids.ops <- read.csv(system.file("symbol_index.csv", package = "kableExtra"))
   ids <- ids.ops[, notation]
   ids.intable <- gsub("\\*", "\\\\*", ids)
-  # ids.simple <- c(
-  #   "*", "\u2020", "\u2021", "\u00A7", "\u00B6",
-  #   "**", "\u2020\u2020", "\u2021\u2021", "\u00A7\u00A7", "\u00B6\u00B6",
-  #   "***", "\u2020\u2020\u2020", "\u2021\u2021\u2021",
-  #   "\u00A7\u00A7\u00A7", "\u00B6\u00B6\u00B6",
-  #   "****", "\u2020\u2020\u2020\u2020", "\u2021\u2021\u2021\u2021",
-  #   "\u00A7\u00A7\u00A7\u00A7", "\u00B6\u00B6\u00B6\u00B6"
-  # )
 
   #count the number of items in label and intable notation
   count.label <- length(label)
diff --git a/R/kable_styling.R b/R/kable_styling.R
index 1d357b2..2d4d148 100644
--- a/R/kable_styling.R
+++ b/R/kable_styling.R
@@ -113,7 +113,7 @@
                              latex_options = "basic",
                              full_width = F,
                              position = c("center", "left", "right",
-                                       "float_left", "float_right"),
+                                          "float_left", "float_right"),
                              font_size = NULL) {
 
   latex_options <- match.arg(
@@ -122,55 +122,151 @@
     several.ok = T
   )
 
-  out = NULL
+  out <- NULL
   out <- as.character(kable_input)
   table_info <- magic_mirror(kable_input)
-  valign <- sub("\\[", "\\\\[", table_info$valign)
-  valign <- sub("\\]", "\\\\]", valign)
-  begin_tabular <- paste0("\\\\begin\\{", table_info$tabular, "\\}", valign)
-  end_tabular <- paste0("\\\\end\\{", table_info$tabular, "\\}")
+  table_info$valign2 <- sub("\\[", "\\\\[", table_info$valign)
+  table_info$valign2 <- sub("\\]", "\\\\]", table_info$valign2)
+  table_info$valign3 <- sub("\\[", "", table_info$valign)
+  table_info$valign3 <- sub("\\]", "", table_info$valign3)
+  table_info$begin_tabular <- paste0("\\\\begin\\{", table_info$tabular, "\\}",
+                                     table_info$valign2)
+  table_info$end_tabular <- paste0("\\\\end\\{", table_info$tabular, "\\}")
 
 
   if ("striped" %in% latex_options) {
-    usepackage_latex("xcolor", "table")
-    out <- paste0(
-      # gray!6 is the same as shadecolor ({RGB}{248, 248, 248}) in pdf_document
-      "\\rowcolors{2}{gray!6}{white}\n",
-      out,
-      "\n\\rowcolors{2}{white}{white}"
-    )
+    out <- styling_latex_striped(out)
   }
 
   # hold_position is only meaningful in a table environment
   if ("hold_position" %in% latex_options & table_info$table_env) {
-    table_env <- "\\\\begin\\{table\\}"
-    out <- sub("\\\\begin\\{table\\}", "\\\\begin\\{table\\}[!h]", out)
+    out <- styling_latex_hold_position(out)
   }
 
-  if ("scale_down" %in% latex_options | full_width) {
-    out <- sub(begin_tabular,
-               paste0("\\\\resizebox\\{\\\\textwidth\\}\\{\\!\\}\\{",
-                      begin_tabular),
-               out)
-    out <- sub(end_tabular, paste0(end_tabular, "\\}"), out)
+  if ("scale_down" %in% latex_options) {
+    out <- styling_latex_scale_down(out, table_info)
   }
 
   if (full_width) {
-    size_matrix <- sapply(sapply(table_info$contents, str_split, " & "), nchar)
-    col_max_length <- apply(size_matrix, 1, max) + 4
-    col_ratio <- round(col_max_length / sum(col_max_length) * 0.9, 2)
-    col_align <- paste0("p{", col_ratio, "\\\\hsize}")
-    col_align <- paste0("{", paste(col_align, collapse = ""), "}")
+    out <- styling_latex_full_width(out, table_info)
+  }
 
-    out <- sub(paste0(begin_tabular, "\\{[^\\\\n]*\\}"), begin_tabular, out)
-    out <- sub(begin_tabular, paste0(begin_tabular, col_align), out)
+  if (!is.null(font_size)) {
+    out <- styling_latex_font_size(out, table_info, font_size)
   }
 
   position <- match.arg(position)
-  if (position == "right") {
-    warning("Right a")
-  }
+  out <- styling_latex_position(out, table_info, position, latex_options)
 
   out <- structure(out, format = "latex", class = "knitr_kable")
   return(out)
 }
+
+styling_latex_striped <- function(x) {
+  usepackage_latex("xcolor", "table")
+  paste0(
+    # gray!6 is the same as shadecolor ({RGB}{248, 248, 248}) in pdf_document
+    "\\rowcolors{2}{gray!6}{white}\n", x, "\n\\rowcolors{2}{white}{white}")
+}
+
+styling_latex_hold_position <- function(x) {
+  sub("\\\\begin\\{table\\}", "\\\\begin\\{table\\}[!h]", x)
+}
+
+styling_latex_scale_down <- function(x, table_info) {
+  # You cannot put longtable in a resizebox
+  # http://tex.stackexchange.com/questions/83457/how-to-resize-or-scale-a-longtable-revised
+  if (table_info$tabular == "longtable") {
+    warning("Longtable cannot be resized.")
+    return(x)
+  }
+  x <- sub(table_info$begin_tabular,
+           paste0("\\\\resizebox\\{\\\\textwidth\\}\\{\\!\\}\\{",
+                  table_info$begin_tabular),
+           x)
+  sub(table_info$end_tabular, paste0(table_info$end_tabular, "\\}"), x)
+}
+
+styling_latex_full_width <- function(x, table_info) {
+  size_matrix <- sapply(sapply(table_info$contents, str_split, " & "), nchar)
+  col_max_length <- apply(size_matrix, 1, max) + 4
+  col_ratio <- round(col_max_length / sum(col_max_length), 2)
+  col_align <- paste0("p{\\\\dimexpr", col_ratio,
+                      "\\\\linewidth-2\\\\tabcolsep}")
+  col_align <- paste0("{", paste(col_align, collapse = ""), "}")
+  x <- sub(paste0(table_info$begin_tabular, "\\{[^\\\\n]*\\}"),
+           table_info$begin_tabular, x)
+  sub(table_info$begin_tabular,
+      paste0(table_info$begin_tabular, col_align), x)
+}
+
+styling_latex_position <- function(x, table_info, position, latex_options) {
+  hold_position <- "hold_position" %in% latex_options
+  switch(
+    position,
+    center = styling_latex_position_center(x, table_info, hold_position),
+    left = styling_latex_position_left(x, table_info),
+    right = styling_latex_position_right(x, table_info, hold_position),
+    float_left = styling_latex_position_float(x, table_info, "l"),
+    float_right = styling_latex_position_float(x, table_info, "r")
+  )
+}
+
+styling_latex_position_center <- function(x, table_info, hold_position) {
+  if (!table_info$table_env & table_info$tabular == "tabular") {
+    table_env_setup <- "\\begin{table}"
+    if (hold_position) {
+      table_env_setup <- paste0(table_env_setup, "[!h]")
+    }
+    return(paste0(table_env_setup, "\n\\centering", x, "\n\\end{table}"))
+  }
+  return(x)
+}
+
+styling_latex_position_left <- function(x, table_info) {
+  if (table_info$tabular != "longtable") return(sub("\\\\centering\\n", "", x))
+  longtable_option <- "\\[l\\]"
+  sub(paste0("\\\\begin\\{longtable\\}", table_info$valign2),
+      paste0("\\\\begin\\{longtable\\}", longtable_option), x)
+}
+
+styling_latex_position_right <- function(x, table_info, hold_position) {
+  warning("Position = right is only supported for longtable in LaTeX. ",
+          "Setting back to center...")
+  styling_latex_position_center(x, table_info, hold_position)
+}
+
+styling_latex_position_float <- function(x, table_info, option) {
+  if (table_info$tabular == "longtable") {
+    warning("wraptable is not supported for longtable.")
+    if (option == "l") return(styling_latex_position_left(x, table_info))
+    if (option == "r") return(styling_latex_position_right(x, table_info, F))
+  }
+  if (table_info$table_env) {
+    usepackage_latex("wrapfig")
+    size_matrix <- sapply(sapply(table_info$contents, str_split, " & "), nchar)
+    col_max_length <- apply(size_matrix, 1, max) + 4
+    option <- sprintf("\\\\begin\\{wraptable\\}\\{%s\\}", option)
+    option <- paste0(option, "\\{",sum(col_max_length) * 0.15, "cm\\}")
+    x <- sub("\\\\begin\\{table\\}\\[\\!h\\]", "\\\\begin\\{table\\}", x)
+    x <- sub("\\\\begin\\{table\\}", option, x)
+    x <- sub("\\\\end\\{table\\}", "\\\\end\\{wraptable\\}", x)
+    return(x)
+  }
+}
+
+styling_latex_font_size <- function(x, table_info, font_size) {
+  row_height <- font_size + 2
+  if (table_info$tabular == "tabular" & table_info$table_env) {
+    return(sub(table_info$begin_tabular,
+               paste0("\\\\fontsize\\{", font_size, "\\}\\{", row_height,
+                      "\\}\\\\selectfont\n", table_info$begin_tabular),
+               x))
+  }
+  # For longtable and tabular without table environment. Simple wrap around
+  # fontsize is good enough
+  return(paste0(
+    "\\begingroup\\fontsize{", font_size, "}{", row_height, "}\\selectfont\n", x,
+    "\\endgroup"
+  ))
+}
diff --git a/R/magic_mirror.R b/R/magic_mirror.R
index a926b25..28be804 100644
--- a/R/magic_mirror.R
+++ b/R/magic_mirror.R
@@ -42,7 +42,7 @@
   # N of columns
   kable_info$ncol <- nchar(kable_info$align)
   # Caption
-  kable_info$caption <- str_match(input, "caption\\{(.*?)\\}")[2]
+  kable_info$caption <- str_match(input, "caption\\{(.*?)\\n")[2]
   # N of rows
   kable_info$nrow <- str_count(input, "\\\\\n") -
     # in the dev version (currently as of 11.2015) of knitr, when longtable is
@@ -55,6 +55,9 @@
     )
   # Contents
   kable_info$contents <- str_match_all(input, "\n(.*)\\\\\\\\")[[1]][,2]
+  if (kable_info$tabular == "longtable" & !is.na(kable_info$caption)) {
+    kable_info$contents <- kable_info$contents[-1]
+  }
   # Column names
   kable_info$colnames <- str_split(kable_info$contents[1], " \\& ")[[1]]
   # Row names
diff --git a/man/add_footnote.Rd b/man/add_footnote.Rd
index 6a9b260..e2060dd 100644
--- a/man/add_footnote.Rd
+++ b/man/add_footnote.Rd
@@ -1,5 +1,5 @@
 % Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/footnote.R
+% Please edit documentation in R/add_footnote.R
 \name{add_footnote}
 \alias{add_footnote}
 \title{Add footnote}
diff --git a/man/kable_styling.Rd b/man/kable_styling.Rd
index c19de6c..5330f97 100644
--- a/man/kable_styling.Rd
+++ b/man/kable_styling.Rd
@@ -4,9 +4,9 @@
 \alias{kable_styling}
 \title{HTML table attributes}
 \usage{
-kable_styling(kable_input, bootstrap_options = "basic", full_width = T,
-  float = c("center", "left", "right"), font_size = NULL,
-  latex_hold_position = F, latex_scale_down = F)
+kable_styling(kable_input, bootstrap_options = "basic",
+  latex_options = "basic", full_width = NULL, position = c("center",
+  "left", "right", "float_left", "float_right"), font_size = NULL)
 }
 \arguments{
 \item{bootstrap_options}{A character vector for bootstrap table options. For
@@ -18,7 +18,7 @@
 \item{full_width}{A `TRUE` or `FALSE` variable controlling whether the HTML
 table should have 100\% width.}
 
-\item{float}{A character string determining whether and how the HTML table
+\item{position}{A character string determining whether and how the HTML table
 should float on the page. Values could be "left", "center", "right"}
 
 \item{font_size}{A numeric input for table font size}
diff --git a/test/visual_tests/.gitignore b/test/visual_tests/.gitignore
new file mode 100644
index 0000000..7ea9e79
--- /dev/null
+++ b/test/visual_tests/.gitignore
@@ -0,0 +1,7 @@
+figure
+*.html
+*.md
+*.pdf
+*.log
+*.tex
+*.synctex.gz
diff --git a/test/visual_tests/add_footnote_html.Rmd b/test/visual_tests/add_footnote_html.Rmd
index 6b23867..4aff116 100644
--- a/test/visual_tests/add_footnote_html.Rmd
+++ b/test/visual_tests/add_footnote_html.Rmd
@@ -29,14 +29,8 @@
 
 ## HTML + bootstrap table
 ```{r through_html_bootstrap}
-kable(dt, format = "html", table.attr = htmlTable_styling()) %>%
+kable(dt, format = "html") %>%
+  kable_styling() %>%
   add_footnote(c("footnote 1", "footnote 2", "footnote 3"))
 ```
 
-## HTML + bootstrap narrow table
-```{r through_latex_longtable}
-kable(dt, format = "html", 
-      table.attr = htmlTable_styling(c("striped", "bordered"), 
-                                     full_width = F)) %>%
-  add_footnote(c("footnote 1", "footnote 2", "footnote 3"))
-```
diff --git a/test/visual_tests/add_footnote_pdf.Rmd b/test/visual_tests/add_footnote_pdf.Rmd
index d29bcaf..491248a 100644
--- a/test/visual_tests/add_footnote_pdf.Rmd
+++ b/test/visual_tests/add_footnote_pdf.Rmd
@@ -1,10 +1,6 @@
 ---
-title: add_footnote - PDF
+title: "add_footnote - PDF"
 output: pdf_document
-vignette: >
-  %\VignetteIndexEntry{Use add_footnote in PDF document}
-  %\VignetteEngine{knitr::rmarkdown} 
-  %\VignetteEncoding{UTF-8}
 ---
 
 # Through Pandoc
diff --git a/test/visual_tests/add_header_above_html.Rmd b/test/visual_tests/add_header_above_html.Rmd
new file mode 100644
index 0000000..fb41d08
--- /dev/null
+++ b/test/visual_tests/add_header_above_html.Rmd
@@ -0,0 +1,24 @@
+---
+title: "add_header_above"
+output: html_document
+---
+
+# Plain LaTeX 
+```{r}
+library(knitr)
+library(kableExtra)
+dt <- mtcars[1:5, 1:4]
+
+kable(dt, format = "html") %>%
+  add_header_above(c(" ", "a" = 2, "b" = 2)) %>%
+  add_header_above(c(" ", "c" = 3, "d" = 1))
+```
+
+# Basic Bootstrap Table
+```{r}
+kable(dt, format = "html") %>%
+  kable_styling(full_width = F, 
+                bootstrap_options = c("striped", "bordered")) %>%
+  add_header_above(c(" ", "a" = 2, "b" = 2)) %>%
+  add_header_above(c(" ", "c" = 3, "d" = 1))
+```
diff --git a/test/visual_tests/add_header_above_pdf.Rmd b/test/visual_tests/add_header_above_pdf.Rmd
index 8b6b195..56b4b4e 100644
--- a/test/visual_tests/add_header_above_pdf.Rmd
+++ b/test/visual_tests/add_header_above_pdf.Rmd
@@ -1,8 +1,6 @@
 ---
 title: "add_header_above"
-output: 
-  pdf_document:
-    keep_tex: true
+output: pdf_document
 ---
 
 # Plain LaTeX 
@@ -13,12 +11,12 @@
 
 kable(dt, format = "latex") %>%
   add_header_above(c(" ", "a" = 2, "b" = 2)) %>%
-  add_header_above(c(" ", "a" = 3, "b" = 1))
+  add_header_above(c(" ", "c" = 3, "d" = 1))
 ```
 
 # Basic Bootstrap Table
 ```{r}
 kable(dt, format = "latex", booktabs = T) %>%
   add_header_above(c(" ", "a" = 2, "b" = 2)) %>%
-  add_header_above(c(" ", "a" = 3, "b" = 1))
+  add_header_above(c(" ", "c" = 3, "d" = 1))
 ```
diff --git a/test/visual_tests/htmlTable_styling.Rmd b/test/visual_tests/htmlTable_styling.Rmd
index d5b1faa..2841214 100644
--- a/test/visual_tests/htmlTable_styling.Rmd
+++ b/test/visual_tests/htmlTable_styling.Rmd
@@ -32,7 +32,7 @@
 ## Striped + Hover
 ```{r}
 kable(dt, format = "html") %>%
-  kable_styling(c("striped", "hover"))
+  kable_styling(c("striped", "hover", "primary"))
 ```
 
 ## Other bootstrap options
@@ -47,15 +47,16 @@
   kable_styling(c("striped", "bordered", "condensed"), full_width = F)
 ```
 
+;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, 
+;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, 
+;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, 
 ```{r}
 kable(dt, format = "html") %>%
-  kable_styling(c("striped", "bordered", "condensed"), full_width = F, 
-                float = "left", font_size = 10) %>%
-  add_header_above(c(" ", "Names" = 2)) %>%
-  add_header_above(c(" " = 2, "Names")) %>%
-  add_header_above(c("Names[note]" = 3)) %>%
-  add_footnote("note")
+  kable_styling(c("striped", "condensed"), full_width = F, 
+                position = "float_right", font_size = 10) %>%
+  add_header_above(c(" ", "Names[note]" = 2)) %>%
+  add_footnote("footnote")
 ```
 
-
+;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, ;ojadsf sadfls;af ewejdalsf,asf ,weifojsfakslf, 
 
diff --git a/test/visual_tests/kable_styling_pdf.Rmd b/test/visual_tests/kable_styling_pdf.Rmd
index 2ea01a2..ba1f1a2 100644
--- a/test/visual_tests/kable_styling_pdf.Rmd
+++ b/test/visual_tests/kable_styling_pdf.Rmd
@@ -5,16 +5,63 @@
     keep_tex: true
 ---
 
-```{r, include=FALSE}
+```{r}
 library(knitr)
 library(kableExtra)
-dt <- mtcars[1:5, 1:2]
-
-kable(dt)
+dt <- mtcars[1:5, 1:8]
 ```
 
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ullamcorper mauris quis risus dignissim pellentesque. Vivamus in est finibus, porta enim in, sagittis sapien. Mauris dapibus ex nec interdum laoreet. Suspendisse sed venenatis nunc. Donec magna mauris, imperdiet eget mi eget, fringilla vestibulum nisl. Pellentesque scelerisque a elit at blandit. Etiam maximus eget urna quis vestibulum. Cras finibus mi non aliquam condimentum. Mauris feugiat libero vitae massa posuere, et congue turpis convallis. Vestibulum aliquam, quam et accumsan posuere, magna nisl ornare nunc, ac sodales metus elit ac erat.
+
 ```{r}
-kable(dt, format = "latex") 
+kable(dt[1:3], format = "latex", booktabs = T, caption = "xxx") %>%
+  kable_styling(latex_options = c("striped", "hold_position"), font_size = 6, position = "float_left")
+```
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ullamcorper mauris quis risus dignissim pellentesque. Vivamus in est finibus, porta enim in, sagittis sapien. Mauris dapibus ex nec interdum laoreet. Suspendisse sed venenatis nunc. Donec magna mauris, imperdiet eget mi eget, fringilla vestibulum nisl. Pellentesque scelerisque a elit at blandit. Etiam maximus eget urna quis vestibulum. Cras finibus mi non aliquam condimentum. Mauris feugiat libero vitae massa posuere, et congue turpis convallis. Vestibulum aliquam, quam et accumsan posuere, magna nisl ornare nunc, ac sodales metus elit ac erat.
+
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ullamcorper mauris quis risus dignissim pellentesque. Vivamus in est finibus, porta enim in, sagittis sapien. Mauris dapibus ex nec interdum laoreet. Suspendisse sed venenatis nunc. Donec magna mauris, imperdiet eget mi eget, fringilla vestibulum nisl. Pellentesque scelerisque a elit at blandit. Etiam maximus eget urna quis vestibulum. Cras finibus mi non aliquam condimentum. Mauris feugiat libero vitae massa posuere, et congue turpis convallis. Vestibulum aliquam, quam et accumsan posuere, magna nisl ornare nunc, ac sodales metus elit ac erat.
+
+```{r}
+kable(dt, format = "latex", booktabs = T, longtable = T) %>%
+  kable_styling(latex_options = c("striped", "hold_position"), font_size = 6, position = "float_left")
+```
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ullamcorper mauris quis risus dignissim pellentesque. Vivamus in est finibus, porta enim in, sagittis sapien. Mauris dapibus ex nec interdum laoreet. Suspendisse sed venenatis nunc. Donec magna mauris, imperdiet eget mi eget, fringilla vestibulum nisl. Pellentesque scelerisque a elit at blandit. Etiam maximus eget urna quis vestibulum. Cras finibus mi non aliquam condimentum. Mauris feugiat libero vitae massa posuere, et congue turpis convallis. Vestibulum aliquam, quam et accumsan posuere, magna nisl ornare nunc, ac sodales metus elit ac erat.
+
+```{r}
+kable(dt, format = "latex", longtable = T) %>%
+  kable_styling(latex_options = c("hold_position"), font_size = 6, position = "float_left")
+```
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ullamcorper mauris quis risus dignissim pellentesque. Vivamus in est finibus, porta enim in, sagittis sapien. Mauris dapibus ex nec interdum laoreet. Suspendisse sed venenatis nunc. Donec magna mauris, imperdiet eget mi eget, fringilla vestibulum nisl. Pellentesque scelerisque a elit at blandit. Etiam maximus eget urna quis vestibulum. Cras finibus mi non aliquam condimentum. Mauris feugiat libero vitae massa posuere, et congue turpis convallis. Vestibulum aliquam, quam et accumsan posuere, magna nisl ornare nunc, ac sodales metus elit ac erat.
+
+
+```{r}
+kable(dt, format = "latex", caption = "sss") %>%
+  kable_styling(latex_options = c("striped", "hold_position"), font_size = 6, position = "float_left")
+```
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ullamcorper mauris quis risus dignissim pellentesque. Vivamus in est finibus, porta enim in, sagittis sapien. Mauris dapibus ex nec interdum laoreet. Suspendisse sed venenatis nunc. Donec magna mauris, imperdiet eget mi eget, fringilla vestibulum nisl. Pellentesque scelerisque a elit at blandit. Etiam maximus eget urna quis vestibulum. Cras finibus mi non aliquam condimentum. Mauris feugiat libero vitae massa posuere, et congue turpis convallis. Vestibulum aliquam, quam et accumsan posuere, magna nisl ornare nunc, ac sodales metus elit ac erat.
+
+```{r}
+kable(dt, format = "latex", booktabs = T, caption = "sss") %>%
+  kable_styling(latex_options = c("striped", "hold_position"), font_size = 6, position = "float_left")
+```
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ullamcorper mauris quis risus dignissim pellentesque. Vivamus in est finibus, porta enim in, sagittis sapien. Mauris dapibus ex nec interdum laoreet. Suspendisse sed venenatis nunc. Donec magna mauris, imperdiet eget mi eget, fringilla vestibulum nisl. Pellentesque scelerisque a elit at blandit. Etiam maximus eget urna quis vestibulum. Cras finibus mi non aliquam condimentum. Mauris feugiat libero vitae massa posuere, et congue turpis convallis. Vestibulum aliquam, quam et accumsan posuere, magna nisl ornare nunc, ac sodales metus elit ac erat.
+
+```{r}
+kable(dt, format = "latex", booktabs = T, longtable = T, caption = "sss") %>%
+  kable_styling(latex_options = c("striped", "hold_position"), font_size = 6, position = "float_left")
+```
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ullamcorper mauris quis risus dignissim pellentesque. Vivamus in est finibus, porta enim in, sagittis sapien. Mauris dapibus ex nec interdum laoreet. Suspendisse sed venenatis nunc. Donec magna mauris, imperdiet eget mi eget, fringilla vestibulum nisl. Pellentesque scelerisque a elit at blandit. Etiam maximus eget urna quis vestibulum. Cras finibus mi non aliquam condimentum. Mauris feugiat libero vitae massa posuere, et congue turpis convallis. Vestibulum aliquam, quam et accumsan posuere, magna nisl ornare nunc, ac sodales metus elit ac erat. 
+
+```{r}
+kable(dt, format = "latex", booktabs = F, longtable = T, caption = "sss") %>%
+  kable_styling(latex_options = c("striped", "hold_position"), font_size = 6, position = "float_left")
 ```