Is it possible to make R markdown to beamer not have R output overflowing the margins

How do I prevent this (image) from happening when converting R markdown to beamer?

Both the R code and R output is overflowing the margins. Here's the code I used

## asdasdad

```{r, echo = TRUE}
rnorm(10, mean = 999999999/999999999 + 1000000001666666 - 1000000000666666, sd = 2)

When I convert to slidy, the R output wraps which is good, though the code doesn't, but at least it gets a scroll bar. Is there any way in slidy to make the code to wrap too?

Yes. See the docs. I recommend avoiding coding more than 60 characters per line as a general practice.

One simple way is to preface the code block


or you can go all-in and hand edit the intermediate tex file to work infinite \LaTeX magic.

Probably the easier path to fine tune is

options(width = 55)

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.