如何在Rmarkdown/ioslides演示文稿中修复列分隔符

Gre*_*gor 20 r rstudio r-markdown

使用目前RStudio(0.98.758)的开发版本,我很高兴我可以创作一个ioslides演示文稿rmarkdown.

这种格式rmarkdown文档介绍了如何进行双列幻灯片,并附带警告:

请注意,内容将在列中流动,因此如果要在一侧显示图像而在另一侧显示文本,则应确保图像具有足够的高度以强制文本到幻灯片的另一侧.

但我似乎无法使图像足够大!文本仍然被推离第一列的底部.在下面的演示文稿中,我想将基本直方图与列中的qplot直方图进行比较,并附有一些注释和代码.我已经为一些相对简短的示例包含了一些基本的解决方案尝试的代码.如果你要编织它,我认为这个问题很明显.(请注意,您需要预览版本的RStudio.)

---
title: "Two Column"
author: "Some guy on Stack Overflow"
date: "Friday, April 04, 2014"
output: ioslides_presentation
---

## Two-Column Attempt {.smaller}

<div class="columns-2">
Base graphics can be quick...

```{r, fig.width = 3, fig.height = 4}
par_opts <- names(par())
    hist(nchar(par_opts),
         breaks = seq(1.5, 9.5, by = 1))
```

But `ggplot2` can be quick too:

```{r, fig.width = 2.5, fig.height = 2.5}
require(ggplot2, quietly = T)
qplot(factor(nchar(par_opts)))
```
</div>

## Two-Column Attempt: Taller Hist {.smaller}

<div class="columns-2">
Base graphics can be quick...

```{r, fig.width = 3, fig.height = 6}
par_opts <- names(par())
    hist(nchar(par_opts),
         breaks = seq(1.5, 9.5, by = 1))
```

But `ggplot2` can be quick too:

```{r, fig.width = 2.5, fig.height = 2.5}
require(ggplot2, quietly = T)
qplot(factor(nchar(par_opts)))
```
</div>

## Two-Column Attempt: Extra div {.smaller}

<div class="columns-2">

Base graphics can be quick...

```{r, fig.width = 3, fig.height = 4}
par_opts <- names(par())
    hist(nchar(par_opts),
         breaks = seq(1.5, 9.5, by = 1))
```

<div>
...
</div>

But `ggplot2` can be quick too:

```{r, fig.width = 2.5, fig.height = 2.5}
require(ggplot2, quietly = T)
qplot(factor(nchar(par_opts)))
```
</div>
Run Code Online (Sandbox Code Playgroud)

这是第4张幻灯片的图像,您可以看到左栏底部的文字被截断,而右栏有足够的空间.

隔断

adi*_*ara 16

我也一直在摸不着头脑.

您可以避免使用div并将其{.columns-2}用作标题属性.

对于图像我默认在yaml中使用fig_height和设置相对较大的大小fig_width.然后,使用块中的out.width属性我控制输出的大小(350px似乎在此布局中运行良好)

---
title: "Two Column"
author: "Some guy on Stack Overflow"
date: "Friday, April 04, 2014"
output:
  ioslides_presentation:
    fig_height: 7
    fig_width: 7
---

## Two-Column Attempt {.smaller .columns-2}

Base graphics can be quick...

```{r, out.width =  '350px'}
par_opts <- names(par())
    hist(nchar(par_opts),
         breaks = seq(1.5, 9.5, by = 1))
```


But `ggplot2` can be quick too:

```{r, out.width =  '350px'}
require(ggplot2, quietly = T)
qplot(factor(nchar(par_opts)))
```
Run Code Online (Sandbox Code Playgroud)