Rmarkdown Beamer跨多个页面重复表头

时间:2018-05-23 18:53:17

标签: r r-markdown beamer kable kableextra

我正在rmarkdown中构建一个beamer演示文稿,我有一个长桌,我使用kable和kableExtra创建,并在两个幻灯片之间分割。我已经能够将表拆分得很好,但我无法重复标题。我在Tex stackexchange页面上找到的解决方案建议使用不同的包,或手动拆分Tex文件中的表。我不认为建议的附加软件包xtab与kableExtra兼容。这是我正在努力的例子。

---
title: Title
author: James 
classoption: table
output:
  beamer_presentation:
    keep_tex: true
    includes:
      in_header: ./R presentaion/header.tex

---

```{r setup, include=FALSE}
library(knitr)
library(kableExtra)
library(magrittr)
options(knitr.kable.NA = '')
```

```{r, echo=FALSE}
long_dt <- rbind(mtcars, mtcars)
```

#Slide {.allowframebreaks}
```{r, echo=FALSE, results='asis'}
kable(mtcars, format = "latex", longtable = TRUE, booktabs = TRUE) %>%
  add_header_above(c(" ", "Group 1" = 5, "Group 2" = 6)) %>%
  kable_styling(latex_options = c("striped", "repeat_header"), font_size = 6)
```

这就是模板文件的样子。

\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}
\usepackage{xtab}

\def\begincols{\begin{columns}}
\def\begincol{\begin{column}}
\def\endcol{\end{column}}
\def\endcols{\end{columns}}

\def\begincols{\begin{columns}}
\def\begincol{\begin{column}}
\def\endcol{\end{column}}
\def\endcols{\end{columns}}

0 个答案:

没有答案