Merge branch 'master' into master
diff --git a/R/add_indent.R b/R/add_indent.R
index 82e587a..b433d9d 100644
--- a/R/add_indent.R
+++ b/R/add_indent.R
@@ -63,8 +63,8 @@
     } else {
       new_rowtext <- latex_indent_unit(rowtext, level_of_indent)
     }
-    out <- sub(paste0(rowtext, "\\\\\\\\"),
-               paste0(new_rowtext, "\\\\\\\\"),
+    out <- sub(paste0(rowtext, "(\\\\\\\\\\*?(\\[.*\\])?\n)"),
+               paste0(new_rowtext, "\\1"),
                out, perl = TRUE)
     table_info$contents[i] <- new_rowtext
   }
diff --git a/R/util.R b/R/util.R
index e623709..b156260 100644
--- a/R/util.R
+++ b/R/util.R
@@ -128,7 +128,11 @@
     new_row <- str_replace(
       dup_row, "(?<=\\s)([\\S]+[\\s]*)$",
       paste0("\\\\\\\\vphantom\\\\{", empty_times, "\\\\}\\1"))
-    kable_input <- sub(dup_row, new_row, kable_input)
+    kable_input <- sub(
+      paste0(dup_row, "(?=\\s*\\\\\\\\\\*?(\\[.*\\])?)"),
+      new_row,
+      kable_input,
+      perl = TRUE)
     table_info$contents[i] <- new_row
   }
   table_info$duplicated_rows <- FALSE