首页 > 解决方案 > 在 R Markdown 演示文稿中设置显示代码块的宽度

问题描述

我想为 R Markdown 演示文稿中显示的代码块设置宽度。在我在下面放置的简单示例中,代码行在ggplot(df, aes(x = time, y = value)) +演示文稿中包含在两行中。我的目标是:

  1. (主要)让它没有被包裹起来,
  2. 理想情况下,使用幻灯片宽度百分比 (%) 为显示的代码块设置宽度。

R Markrdown 代码:

Presentation title
========================================================
author: Marta 
date: February 9, 2019
autosize: true

Simple plot 
==========================

<small><small><small>
```{r, fig.width = 10, fig.height = 5}
## Make some foo data frame
df <- data.frame(time = 1:10, value = rnorm(10))

## Plot
library(ggplot2)
ggplot(df, aes(x = time, y = value)) + 
  geom_point() + 
  geom_line()
```
</small></small></small>

呈现的演示文稿的幻灯片屏幕截图:

在此处输入图像描述

标签: rr-markdownslidepresentation

解决方案


推荐阅读