Search code examples
rkableextra

KableExtra + R tune caption (Font, size, color, etc...)


I cannot find the option to tune the font size and other caption parameters in kableExtra.

Have a look at the following

kable(dt, "latex", caption = "Demo table", booktabs = T) %>%
kable_styling(latex_options = c("striped", "hold_position"))

Any help is appreciated!


Solution

  • Do you want this for all captions? Then, the following should do the trick.

    ---
    title: "Demo"
    author: "H"
    header-includes:
        - \usepackage{caption}
        - \captionsetup{font=Huge}
    output: pdf_document
    ---
    
    ```{r}
    library("kableExtra")
    
    kable(head(mtcars), "latex", caption = "Demo table", booktabs = TRUE) %>%
        kable_styling(latex_options = c("striped", "hold_position"))
    ```