I have the following tint
PDF document:
---
title: "Title"
subtitle: "Subtitle"
author: "Author"
date: "`r Sys.Date()`"
output: tint::tintPdf
---
```{r echo = FALSE, message = FALSE}
# Load library
library(dplyr)
# Create data frame
df <- data.frame(A = runif(10),
B = runif(10),
C = runif(10),
D = runif(10),
E = runif(10),
F = runif(10),
G = runif(10),
H = runif(10))
# Print as a table
knitr::kable(df, booktabs = TRUE, format = "latex",
caption = "This is a caption in the margin.")
```
This produces a PDF with the following table:
The table is wide and spills out over the caption. To avoid this, I can specify it's a full width table using full_width = TRUE
in the kable_styling
function of kableExtra
.
---
title: "Title"
subtitle: "Subtitle"
author: "Author"
date: "`r Sys.Date()`"
output: tint::tintPdf
---
```{r echo = FALSE, message = FALSE}
# Load library
library(dplyr)
# Create data frame
df <- data.frame(A = runif(10),
B = runif(10),
C = runif(10),
D = runif(10),
E = runif(10),
F = runif(10),
G = runif(10),
H = runif(10))
# Print as a table
knitr::kable(df, booktabs = TRUE, format = "latex",
caption = "This is a caption in the margin.") %>%
kableExtra::kable_styling(full_width = TRUE)
```
This gives the following error:
! LaTeX Error: Environment tabu undefined.
Error: Failed to compile Test.tex. See Test.log for more info. Execution halted
It seems to be upset about the tabu
package (or lack thereof). So, I add in this package in my YAML, like so:
---
title: "Title"
subtitle: "Subtitle"
author: "Author"
date: "`r Sys.Date()`"
output: tint::tintPdf
header-includes:
- \usepackage{tabu}
---
This runs, but produces the following:
Now, the contents of the table overlaps. Humpf. Even if I include fig.fullwidth = TRUE
in the chunk options I have no luck.
How do I produce a full width table in this situation?