Having some trouble with kable_styling()
in R markdown. https://haozhu233.github.io/kableExtra/awesome_table_in_pdf.pdf has a great vignette on styling tables in Rmd files to pdf but still having trouble with kable_styling(latex_options = "striped")
as it comes up with an error !undefined control sequence. \rowcolor
.
Code in R chunk is
kableExtra::kable(results,caption = "Results", "latex", booktabs = TRUE) %>%
kable_styling(latex_options = "striped")
I've tried \usepackage[table]{xcolor}
and a few other whack-a-mole techniques and still an error. I will show you the YAML i'm using with an additional "in_header" file. Any help would be much appreciated.
---
title: "Water Yield"
author: "Josh Erickson"
date: "January 28, 2020"
output:
pdf_document:
fig_caption: yes
includes:
in_header: my_header.tex
bibliography: WaterYield.bib
tables: true
---
"my_header.tex" is below
\usepackage{float}
\let\origfigure\figure
\let\endorigfigure\endfigure
\renewenvironment{figure}[1][2] {
\expandafter\origfigure\expandafter[H]
} {
\endorigfigure
}
- \usepackage{booktabs}
- \usepackage{longtable}
- \usepackage{array}
- \usepackage{multirow}
- \usepackage{wrapfig}
- \usepackage{float}
- \usepackage{colortbl}
- \usepackage{pdflscape}
- \usepackage{tabu}
- \usepackage{threeparttable}
- \usepackage{threeparttablex}
- \usepackage[normalem]{ulem}
- \usepackage{makecell}
- \usepackage{xcolor}