2nd attempt to fix #37
should be fixed now
diff --git a/R/magic_mirror.R b/R/magic_mirror.R
index 5fb9adc..81f4249 100644
--- a/R/magic_mirror.R
+++ b/R/magic_mirror.R
@@ -59,8 +59,11 @@
   kable_info$ncol <- nchar(kable_info$align)
   # Caption
   if (str_detect(kable_input, "caption\\[")) {
-    kable_info$caption.short <- str_match(kable_input, "caption\\[(.*?)\\]")[2]
-    kable_info$caption <- str_match(kable_input, "caption.*?\\{(.*?)\\n")[2]
+    caption_line <- str_match(kable_input, "\\\\caption(.*)\\n")[2]
+    kable_info$caption.short <- str_match(caption_line, "\\[(.*?)\\]")[2]
+    kable_info$caption <- substr(caption_line,
+                                 nchar(kable_info$caption.short) + 4,
+                                 nchar(caption_line) - 1)
   } else {
     kable_info$caption <- str_match(kable_input, "caption\\{(.*?)\\n")[2]
   }
diff --git a/tests/visual_tests/kable_styling_pdf.Rmd b/tests/visual_tests/kable_styling_pdf.Rmd
index b48fe35..87bdc30 100644
--- a/tests/visual_tests/kable_styling_pdf.Rmd
+++ b/tests/visual_tests/kable_styling_pdf.Rmd
@@ -14,8 +14,7 @@
 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ullamcorper mauris quis risus dignissim pellentesque. Vivamus in est finibus, porta enim in, sagittis sapien. Mauris dapibus ex nec interdum laoreet. Suspendisse sed venenatis nunc. Donec magna mauris, imperdiet eget mi eget, fringilla vestibulum nisl. Pellentesque scelerisque a elit at blandit. Etiam maximus eget urna quis vestibulum. Cras finibus mi non aliquam condimentum. Mauris feugiat libero vitae massa posuere, et congue turpis convallis. Vestibulum aliquam, quam et accumsan posuere, magna nisl ornare nunc, ac sodales metus elit ac erat.
 
 ```{r}
-kable(dt[1:3], format = "latex", booktabs = T, caption = "xxx") %>%
-  kable_styling(latex_options = c("striped", "hold_position"), font_size = 6, position = "float_left")
+kable(dt[1:3], format = "latex", booktabs = T, caption = "xxx") 
 ```
 
 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ullamcorper mauris quis risus dignissim pellentesque. Vivamus in est finibus, porta enim in, sagittis sapien. Mauris dapibus ex nec interdum laoreet. Suspendisse sed venenatis nunc. Donec magna mauris, imperdiet eget mi eget, fringilla vestibulum nisl. Pellentesque scelerisque a elit at blandit. Etiam maximus eget urna quis vestibulum. Cras finibus mi non aliquam condimentum. Mauris feugiat libero vitae massa posuere, et congue turpis convallis. Vestibulum aliquam, quam et accumsan posuere, magna nisl ornare nunc, ac sodales metus elit ac erat.
@@ -62,7 +61,7 @@
 
 ```{r}
 kable(dt, format = "latex", booktabs = F, longtable = T, caption = "sss") %>%
-  kable_styling(latex_options = c("striped", "hold_position"), font_size = 6, position = "float_left")
+  kable_styling(latex_options = c("striped", "hold_position"), font_size = 6)
 ```