在使用RMarkdown的ioslides准备演示文稿时,我遇到了一个我无法找到解决方案的问题。 This answer也没有解决这个具体问题。
有时候,双列布局最好解释一边是图像而另一边是文字。但是,如下例所示,列分隔符似乎不能按预期工作。
有没有办法在特定点强制列分类?我想过要增加右边的图像高度,但不幸的是,有时候这不是一个选择。
---
title: "Some stange column break"
output:
ioslides_presentation:
widescreen: true
---
## Slide Title {.columns-2 .smaller}
### Slide Subtitle
>- Some bullet points which take up some space space space space space space space
>- on the column on the left
>- which are then wrapped to the right column.
>- *Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.*
>- line break after this longer bullet point but intead it breaks in some strange place even though it would have space at the bottom of the left column!
<!-- the columns should break here -->
```{r, echo = FALSE, out.width = "470px"}
plot(mtcars)
```
答案 0 :(得分:5)
我过去曾经使用过两种方法,这两种方法都可以解答您所链接的问题。我是否想知道为什么这些都不满足您的需求?
方法1似乎是您所追求的,但是我个人倾向于使用方法2,因为我喜欢具有不同宽度的列的灵活性。
注意:我仅使用ioslides
格式
这需要定义一个附加的CSS类,您可以在文档的开头内联。
---
title: "Untitled"
output:
ioslides_presentation:
widescreen: true
---
<style>
.forceBreak { -webkit-column-break-after: always; break-after: column; }
</style>
## Slide Title {.columns-2 .smaller}
### Slide Subtitle
>- Some bullet points which take up some space space space space space space space
>- on the column on the left
>- which are then wrapped to the right column.
>- *Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.*
>- line break after this longer bullet point but intead it breaks in some strange place even though it would have space at the bottom of the left column!
<p class="forceBreak"></p>
```{r, echo = FALSE, fig.width=4.7}
plot(mtcars)
```
此方法不需要任何其他CSS定义或外部文件。
---
title: "Untitled"
output: ioslides_presentation
---
## Another Method for Two Column Layouts
<div style="float: left; width: 40%;">
+ This text is on the left
</div>
<div style="float: right; width: 60%;">
+ This text is on the right
</div>
答案 1 :(得分:0)
您可以通过在添加 clear
样式的第二列下方添加一个空 div 来阻止内容占用第二列下方的空间,从而禁用更下方元素的回流。
<div style="clear: both;"></div>