C. Hammill
C. Hammill

Reputation: 342

Rmarkdown beamer ignoring size option

I'm trying to create a presentation with Rmarkdown and beamer and I am unable to adjust the size of my code and output. In the past I edited the beamer template to work around this but I was hoping there is a better way.

For example:

---
title: "Reprex"
output:
  beamer_presentation
---

## Output one

```{r, size="footnotesize"}
1:50
```

renders identical to:

---
title: "Reprex"
output:
  beamer_presentation
---

## Output one

```{r}
1:50
```

Any thoughts on how to fix this?

Upvotes: 2

Views: 1006

Answers (1)

CL.
CL.

Reputation: 14957

The size option specifies the "font size for the default LaTeX output" (source). But you are writing rmarkdown which is converted to PDF afterwards.

A workaround:

---
output: beamer_presentation 
---

## Output one

Foo.

```{r, echo = FALSE}
knitr::asis_output("\\footnotesize")
1:10 # this will be small
knitr::asis_output("\\normalsize")
11:20 # this not
```

Bar.

Depending on how often this is used it could be work using a helper function or even a chunk hook to print the font size commands.

Upvotes: 1

Related Questions