Allow no colnames with PDF output when booktabs enabled
diff --git a/R/magic_mirror.R b/R/magic_mirror.R
index e6503b4..927aaec 100644
--- a/R/magic_mirror.R
+++ b/R/magic_mirror.R
@@ -90,7 +90,15 @@
   }
   kable_info$duplicated_rows <- (sum(duplicated(kable_info$contents)) != 0)
   # Column names
-  kable_info$colnames <- str_split(kable_info$contents[1], " \\& ")[[1]]
+  if (kable_info$booktabs) {
+    if (is.na(which(read_lines(kable_input) == "\\midrule")[1])) {
+      kable_info$colnames <- NULL
+    } else {
+      kable_info$colnames <- str_split(kable_info$contents[1], " \\& ")[[1]]
+    }
+  } else {
+    kable_info$colnames <- str_split(kable_info$contents[1], " \\& ")[[1]]
+  }
   # Row names
   kable_info$rownames <- str_extract(kable_info$contents, "^[^ &]*")