【发布时间】:2020-05-16 13:38:06
【问题描述】:
在 R markdown 中使用 kable_styling() 时遇到了一些问题。 https://haozhu233.github.io/kableExtra/awesome_table_in_pdf.pdf 在将 Rmd 文件中的表格样式设置为 pdf 时有一个很棒的小插图,但在使用 kable_styling(latex_options = "striped") 时仍然遇到问题,因为它会出现错误 !undefined control sequence. \rowcolor。
R块中的代码是
kableExtra::kable(results,caption = "Results", "latex", booktabs = TRUE) %>%
kable_styling(latex_options = "striped")
我尝试了\usepackage[table]{xcolor} 和其他一些打地鼠技术,但仍然出错。我将向您展示我正在使用的 YAML 以及附加的“in_header”文件。任何帮助将不胜感激。
---
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”在下面
\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}
【问题讨论】:
标签: r r-markdown pdflatex kable kableextra