简体   繁体   English

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

[英]How can I fix column breaks in an Rmarkdown / ioslides presentation

Using what is currently the development version of RStudio (0.98.758), I'm loving that I can author an ioslides presentation in rmarkdown . 使用目前RStudio(0.98.758)的开发版本,我很高兴能在rmarkdown创作ioslides演示文稿。

The rmarkdown docs for this format give a description of how to do a two-column slide, and it comes with the warning that: 这种格式rmarkdown文档介绍了如何进行双列幻灯片,并附带警告:

Note that content will flow across the columns so if you want to have an image on one side and text on the other you should make sure that the image has sufficient height to force the text to the other side of the slide. 请注意,内容将在列中流动,因此,如果要在一侧显示图像而在另一侧显示文本,则应确保图像具有足够的高度以将文本强制到幻灯片的另一侧。

But I can't seem to possibly make an image big enough! 但我似乎无法使图像足够大! Text still gets pushed off the bottom of the first column. 文本仍然被推离第一列的底部。 In the presentation below, I'd like to compare a base histogram with a qplot histogram side-by-side in columns, with a few comments and code. 在下面的演示文稿中,我想在列中并排比较基本直方图和qplot直方图,并附上一些注释和代码。 I've included code for a relatively short example with some basic solution attempts. 我已经为一些相对简短的示例包含了一些基本的解决方案尝试的代码。 If you'll knit it, I think the problem will be obvious. 如果你要编织它,我认为这个问题很明显。 (Note that you will need a preview version of RStudio .) (请注意,您需要预览版本的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>

Here's an image of the 4th slide, you can see text is cut off at the bottom of the left column, while the right column has plenty of space. 这是第4张幻灯片的图像,您可以看到左栏底部的文字被截断,而右栏有足够的空间。

隔断

I've been scratching my head around this also. 我也一直在摸不着头脑。

You can avoid using the divs and use {.columns-2} as a header attribute. 您可以避免使用div并使用{.columns-2}作为标头属性。

For the images I set a relatively large size by default in the yaml using fig_height and fig_width . 对于图像,我使用fig_heightfig_width在yaml中默认设置相对较大的大小。 Then, using the out.width attribute in the chunk I control the size of the output (350px seems to work well in this layout) 然后,使用块中的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)))
```

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用rmarkdown在ioslides演示文稿中制作可滚动幻灯片 - How to make scrollable slides in an ioslides presentation with rmarkdown 如何使用 rmarkdown 渲染来渲染 ioslides 演示文稿? - how to use rmarkdown render to render ioslides presentation? RMarkdown:如何调整要显示为 ioslides 演示文稿的表格大小? - RMarkdown: How to resize a table to be displayed into a ioslides presentation? RMarkdown ioslides HD演示文稿 - RMarkdown ioslides presentation in HD 如何使用ioslides在rmarkdown演示文稿中填充整个幻灯片? - How to make an image fill the entire slide in an rmarkdown presentation using ioslides? 如何为使用 rmarkdown 生成的 ioslides_presentation 处理 UTF-8 字符 - How to process UTF-8 characters for an ioslides_presentation generated with rmarkdown 将rmarkdown ioslides演示文稿另存为独立网站 - Save a rmarkdown ioslides presentation as standalone website 如何使用 ioslides 演示文稿和 DT package 安装交互式表格? - How can I fit an interactive table using ioslides presentation and DT package? 如何使用Rmarkdown在ioslide演示文稿中逐步构建绘图? - How can I incrementally build a plot in an ioslide presentation using Rmarkdown? 如何使用css文件更改ioslides rmarkdown中项目符号的文本颜色 - How I change the text color of bullets in ioslides rmarkdown with a css file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM