add notes for linebreak in table caption
diff --git a/docs/best_practice_for_newline_in_latex_table.Rmd b/docs/best_practice_for_newline_in_latex_table.Rmd
index 63b3ec5..d9bdb48 100644
--- a/docs/best_practice_for_newline_in_latex_table.Rmd
+++ b/docs/best_practice_for_newline_in_latex_table.Rmd
@@ -4,6 +4,7 @@
date: "`r Sys.Date()`"
output: pdf_document
header-includes:
+ - \usepackage{caption}
- \usepackage{booktabs}
- \usepackage{longtable}
- \usepackage{array}
@@ -63,9 +64,12 @@
dt2 %>%
mutate_all(linebreak) %>%
kable("latex", booktabs = T, escape = F,
+ caption = "Main Title\\\\Subtitle",
col.names = linebreak(c("Item\n(Name)", "Value\n(Number)"), align = "c"))
```
+Note that linebreaks in table captions should be treated in a different way. You will need to insert the linebreak (`\\\\`) by yourself manually, which is easier than using `linebreak`. `linebreak` doesn't work because it put things in a `makecell`, which doesn't work in caption (as it's not a cell :P). At the same time, if you are using kableExtra 0.9.0 or any previous version, you need to load the `caption` package in LaTeX by yourself.
+
### Linebreak in other kableExtra functions
If you have a need to put a linebreak in `kableExtra` functions such as `add_header_above` and `group_rows`, just go ahead and use `\n` directly (in kableExtra >= 0.8.0) and it will be automatically converted. Note that this feature is also controlled by the `escape` option in those functions.
diff --git a/docs/best_practice_for_newline_in_latex_table.pdf b/docs/best_practice_for_newline_in_latex_table.pdf
index 15528fc..392f2a1 100644
--- a/docs/best_practice_for_newline_in_latex_table.pdf
+++ b/docs/best_practice_for_newline_in_latex_table.pdf
Binary files differ