Fix #188
diff --git a/R/row_spec.R b/R/row_spec.R
index d344c9a..7bfb68e 100644
--- a/R/row_spec.R
+++ b/R/row_spec.R
@@ -198,23 +198,15 @@
                                      underline, strikeout,
                                      color, background, align, font_size, angle,
                                      hline_after, extra_latex_after)
-    if (i == 1 & table_info$tabular == "longtable") {
-      if (length(new_row) == 1) {
-        out <- gsub(target_row, new_row, out, perl = T)
-      } else {
-        out <- gsub(paste0(target_row, "\\\\\\\\"),
-                   paste(new_row, collapse = ""), out, perl = T)
-      }
+    temp_sub <- ifelse(i == 1 & table_info$tabular == "longtable", gsub, sub)
+    if (length(new_row) == 1) {
+      out <- temp_sub(target_row, new_row, out, perl = T)
+      table_info$contents[i] <- new_row
     } else {
-      if (length(new_row) == 1) {
-        out <- sub(target_row, new_row, out, perl = T)
-      } else {
-        out <- sub(paste0(target_row, "\\\\\\\\"),
-                   paste(new_row, collapse = ""), out, perl = T)
-      }
+      out <- temp_sub(paste0(target_row, "\\\\\\\\"),
+                  paste(new_row, collapse = ""), out, perl = T)
+      table_info$contents[i] <- new_row[1]
     }
-
-    table_info$contents[i] <- new_row
   }
 
   out <- structure(out, format = "latex", class = "knitr_kable")
diff --git a/inst/NEWS.md b/inst/NEWS.md
index 46b21f0..32a9bb8 100644
--- a/inst/NEWS.md
+++ b/inst/NEWS.md
@@ -10,6 +10,11 @@
 
 * Added support to slidy_presentation & ioslides_presentation
 
+* Fixed header formatting for repeated header row in latex longtable (#183)
+
+* 
+
+
 kableExtra 0.8.0
 --------------------------------------------------------------------------------
 * Now kableExtra imports & exports knitr::kable so users don't need to load knitr entirely to NAMESPACE when it's not necessary, for example, in shiny.