finishing save_kable latex part
diff --git a/R/kable_styling.R b/R/kable_styling.R
index bf0bd53..b693b3b 100644
--- a/R/kable_styling.R
+++ b/R/kable_styling.R
@@ -44,6 +44,8 @@
 #' 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 stripe_index LaTeX option allowing users to customize which rows
+#' should have stripe color.
 #' @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.
@@ -79,6 +81,7 @@
                           repeat_header_method = c("append", "replace"),
                           repeat_header_continued = FALSE,
                           stripe_color = "gray!6",
+                          stripe_index = NULL,
                           latex_table_env = NULL,
                           protect_latex = TRUE) {
 
@@ -131,6 +134,7 @@
                             repeat_header_method = repeat_header_method,
                             repeat_header_continued = repeat_header_continued,
                             stripe_color = stripe_color,
+                            stripe_index = stripe_index,
                             latex_table_env = latex_table_env))
   }
 }
@@ -250,6 +254,7 @@
                              repeat_header_method,
                              repeat_header_continued,
                              stripe_color,
+                             stripe_index,
                              latex_table_env) {
 
   latex_options <- match.arg(
@@ -264,7 +269,7 @@
   table_info <- magic_mirror(kable_input)
 
   if ("striped" %in% latex_options) {
-    out <- styling_latex_striped(out, table_info, stripe_color)
+    out <- styling_latex_striped(out, table_info, stripe_color, stripe_index)
   }
 
   # hold_position is only meaningful in a table environment
@@ -329,9 +334,11 @@
   return(out)
 }
 
-styling_latex_striped <- function(x, table_info, color) {
-  striped_rows <- seq(1, table_info$nrow, 2)
-  row_spec(x, striped_rows, background = color)
+styling_latex_striped <- function(x, table_info, color, stripe_index) {
+  if (is.null(stripe_index)) {
+    striped_index <- seq(1, table_info$nrow, 2)
+  }
+  row_spec(x, striped_index, background = color)
 }
 
 styling_latex_hold_position <- function(x) {
diff --git a/R/save_kable.R b/R/save_kable.R
index 85ed54a..7870af7 100644
--- a/R/save_kable.R
+++ b/R/save_kable.R
@@ -24,7 +24,7 @@
                        bs_theme = "simplex", self_contained = TRUE,
                        extra_dependencies = NULL, ...,
                        latex_header_includes = NULL, keep_tex = FALSE) {
-  if (attr(x, "format") == "latex") {
+  if (!is.null(attr(x, "format")) && attr(x, "format") == "latex") {
     return(save_kable_latex(x, file, latex_header_includes, keep_tex))
   }
   return(save_kable_html(x, file, bs_theme, self_contained,
@@ -36,6 +36,7 @@
   dependencies <- list(
     rmarkdown::html_dependency_jquery(),
     rmarkdown::html_dependency_bootstrap(theme = bs_theme),
+    rmarkdown::html_dependency_font_awesome(),
     html_dependency_kePrint()
   )
   if (!is.null(extra_dependencies)) {
@@ -66,6 +67,8 @@
       unlink("lib", recursive = TRUE)
     }
   }
+
+  return(file)
 }
 
 save_kable_latex <- function(x, file, latex_header_includes, keep_tex) {
@@ -89,7 +92,7 @@
   )
   temp_tex <- paste(temp_tex, collapse = "\n")
 
-  temp_tex_file <- tools::file_path_sans_ext(file)
+  temp_tex_file <- paste0(tools::file_path_sans_ext(file), ".tex")
   writeLines(temp_tex, temp_tex_file, useBytes = T)
   system(paste0("xelatex -interaction=batchmode ", temp_tex_file))
   if (!keep_tex) {
@@ -98,23 +101,22 @@
     unlink(temp_file_delete)
   }
 
-  table_img_pdf <- try(magick::image_read(paste0(temp_file, ".pdf"),
-                                          density = density),
-                       silent = T)
-  if (class(table_img_pdf) == "try-error") {
-    stop("Ghostscript is required to read PDF on windows. ",
-         "Please download it here: https://ghostscript.com/")
+  if (tools::file_ext(file) != "pdf") {
+    table_img_pdf <- try(
+      magick::image_read(paste0(tools::file_path_sans_ext(file), ".pdf"),
+                         density = 300), silent = T)
+    if (class(table_img_pdf) == "try-error") {
+      stop("We hit an error when trying to use magick to read the generated ",
+           "PDF file. If you are using Windows, it could be possible that you",
+           " had not installed ghostscript (https://ghostscript.com/). ",
+           "Otherwise, you may check your magick installation and try to ",
+           "use magick::image_read to read the PDF file manually. ")
+    }
+    unlink(paste0(tools::file_path_sans_ext(file), ".pdf"))
+    table_img <- magick::image_convert(table_img_pdf,
+                                       tools::file_ext(file))
+    magick::image_write(table_img, file)
   }
-  if (!keep_pdf) {
-    unlink(paste0(temp_file, ".pdf"))
-  }
-  table_img <- magick::image_convert(table_img_pdf, file_format)
-  if (!is.null(filename)) {
-    temp_img <- paste0(filename, ".", file_format)
-  } else {
-    temp_img <- tempfile(fileext = paste0(".", file_format))
-  }
-  magick::image_write(table_img, temp_img)
 
-  include_graphics(temp_img)
+  return(file)
 }