Merge pull request #490 from DanChaltiel/patch-1

Create remove_column.R
diff --git a/R/add_indent.R b/R/add_indent.R
index 8a90c49..a50547d 100644
--- a/R/add_indent.R
+++ b/R/add_indent.R
@@ -103,7 +103,6 @@
     }
 
     for (j in target_cols) {
-      print(j)
       node_to_edit <- xml_child(row_to_edit, j)
       if (!xml_has_attr(node_to_edit, "indentlevel")) {
         xml_attr(node_to_edit, "style") <- paste(
diff --git a/R/collapse_rows.R b/R/collapse_rows.R
index b837194..5491529 100644
--- a/R/collapse_rows.R
+++ b/R/collapse_rows.R
@@ -238,7 +238,7 @@
       )
       new_contents[i] <- paste0(new_contents[i], "\\\\\\\\\n", row_midrule)
     }
-    out <- sub(contents[i + 1], new_contents[i], out)
+    out <- sub(contents[i + 1], new_contents[i], out, perl=TRUE)
   }
   out <- gsub("\\\\addlinespace\n", "", out)
 
diff --git a/R/print.R b/R/print.R
index cf6ba64..09e7cef 100644
--- a/R/print.R
+++ b/R/print.R
@@ -6,7 +6,10 @@
     html_dependency_kePrint()
   )
   html_kable <- htmltools::browsable(
-    htmltools::HTML(as.character(x))
+    htmltools::HTML(
+      as.character(x),
+      '<script type="text/x-mathjax-config">MathJax.Hub.Config({tex2jax: {inlineMath: [["$","$"], ["\\(","\\)"]]}})</script>;<script async src="https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>'
+      )
   )
   htmlDependencies(html_kable) <- dep
   class(html_kable) <- "shiny.tag.list"
diff --git a/R/row_spec.R b/R/row_spec.R
index ff95c0e..cc8978e 100644
--- a/R/row_spec.R
+++ b/R/row_spec.R
@@ -198,7 +198,9 @@
                                      underline, strikeout,
                                      color, background, align, font_size, angle,
                                      hline_after, extra_latex_after)
-    temp_sub <- ifelse(i == 1 & table_info$tabular == "longtable", gsub, sub)
+    temp_sub <- ifelse(i == 1 & (table_info$tabular == "longtable" |
+                                   !is.null(table_info$repeat_header_latex)),
+                       gsub, sub)
     if (length(new_row) == 1) {
       out <- temp_sub(target_row, new_row, out, perl = T)
       table_info$contents[i] <- new_row
diff --git a/R/util.R b/R/util.R
index 12cc526..26d593d 100644
--- a/R/util.R
+++ b/R/util.R
@@ -117,20 +117,6 @@
 
 # Fix duplicated rows in LaTeX tables
 fix_duplicated_rows_latex <- function(kable_input, table_info) {
-  # dup_items <- table(table_info$contents)
-  # dup_items <- dup_items[dup_items != 1]
-  #
-  # for (di in seq(length(dup_items))) {
-  #   dup_row <- names(dup_items[di])
-  #   di_index <- which(table_info$contents == dup_row)
-  #   for (i in seq(dup_items[di])) {
-  #     new_row <- str_replace(
-  #       dup_row, "(?<=\\s)([\\S]+[\\s]*)$",
-  #       paste0("\\\\\\\\vphantom\\\\{", i, "\\\\} \\1"))
-  #     kable_input <- sub(dup_row, new_row, kable_input)
-  #     table_info$contents[di_index[i]] <- new_row
-  #   }
-  # }
   # Since sub/string_replace start from beginning, we count unique value from
   # behind.
   rev_contents <- rev(table_info$contents)
diff --git a/docs/awesome_table_in_pdf.pdf b/docs/awesome_table_in_pdf.pdf
index 1282956..846ec7a 100644
--- a/docs/awesome_table_in_pdf.pdf
+++ b/docs/awesome_table_in_pdf.pdf
Binary files differ
diff --git a/inst/NEWS.md b/inst/NEWS.md
index 2cd6aef..bc7140e 100644
--- a/inst/NEWS.md
+++ b/inst/NEWS.md
@@ -15,6 +15,13 @@
 * Fixed a bug with `group_rows` when used with `repeat_header` on the last row
 (#476)
 
+* Added mathjax to preview (#473)
+
+* Fixed a bug with `repeat_header` when the header row is customized (#480)
+
+* Fixed a bug with `collapse_rows` when text is too long. (#464)
+
+
 
 kableExtra 1.1.0
 --------------------------------------------------------------------------------