0

我想从 R Markdown 创建一个 HTML 文档作为 ioslides_presentation。我想在表格上使用 kable_styling bootstrap_options 并生成默认为宽屏模式的演示文稿。

我可以生成一个包含按预期呈现的表格的文档kable_styling(bootstrap_options = c("striped", "hover"))

---
title: "ioslides_and_kable_styling"
output:
  ioslides_presentation
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

```{r, message=FALSE}
library(dplyr)
library(kableExtra)
```

## My title

```{r results='asis'}
data <- tibble(Column1 = c("A", "B"), Column2 = c(1, 2))
data %>% knitr::kable(format = "html", caption = "My table") %>% 
    kable_styling(position = "right", bootstrap_options = c("striped", "hover"))
```

使用 bootstrap_options 滑动

或者我可以生成一个默认为宽屏模式的文档,其中 bootstrap_options 被“忽略”:

---
title: "ioslides_and_kable_styling"
output:
  ioslides_presentation:
    widescreen: true
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

```{r, message=FALSE}
library(dplyr)
library(kableExtra)
```

## My title

```{r results='asis'}
data <- tibble(Column1 = c("A", "B"), Column2 = c(1, 2))
data %>% knitr::kable(format = "html", caption = "My table") %>% 
    kable_styling(position = "right", bootstrap_options = c("striped", "hover"))
```

宽屏幻灯片

有没有办法两者兼得?

4

0 回答 0