简体   繁体   中英

Passing multiple frame options to a single frame in an rmarkdown::beamer_presentation

How to pass several frame options to a specific frame in an rmarkdown::beamer_presentation ?

In the MWE below, the second frame should contain the same table as on the frame before, just with a few more rows.

Thus,

  1. the page numbering is ideally the same for both frame (=> {.noframenumbering} )

  2. to simply add the rows on frame 2 below those on frame 1, the content of both frame should be top-aligned (=> {.t} ). Since some other slides require vertical center alignment of frame content, setting classoption: t in the YAML header would be undesired.

MWE

---
output:
  bookdown::pdf_book:
    base_format: rmarkdown::beamer_presentation
    slide_level: 2
    keep_tex: true
---

## Slide

```{r table, cars, echo = FALSE}
library(kableExtra)
knitr::kable(head(mtcars[1:3, 1:3]), caption = "Table caption")
```

## Slide {.noframenumbering}

```{r table, cars2, echo = FALSE}
library(kableExtra)
knitr::kable(head(mtcars[1:6, 1:3]), caption = "Table caption")
```

(adding multiple classoptions in the YAML-header is feasible by separating them with a comma, eg classoption: t, aspectratio=169 . The same approach did not work for me in adjusting them for a single frame though, ie, ## Slide {.noframenumbering,.t} .)

You can use the following syntax to pass multiple options to a frame:

---
output:
  bookdown::pdf_book:
    base_format: rmarkdown::beamer_presentation
    slide_level: 2
    keep_tex: true
---

## Slide {.t}

```{r table, cars, echo = FALSE}
library(kableExtra)
knitr::kable(head(mtcars[1:3, 1:3]), caption = "Table caption")
```

## Slide {.noframenumbering .t}

```{r table, cars2, echo = FALSE}
library(kableExtra)
knitr::kable(head(mtcars[1:6, 1:3]), caption = "Table caption")
```

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM