带有 .pull-left[] 的两列中的 Rmarkdown 不能工作两次

Ram*_*mon 5 r multiple-columns r-markdown xaringan

使用 Rmarkdown 制作幻灯片xaringan。我想要解释左列代码和右列代码本身的文本。在每张幻灯片上,我第一次尝试时,它都有效;但第二次它变得笨拙:右列在左列完成后开始并且未对齐。

YAML 标头

---
title: "reprex-left.right"
author: "Ramon Gallego"
date: "4/10/2020"
output:   xaringan::moon_reader
---
Run Code Online (Sandbox Code Playgroud)
```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
knitr::opts_chunk$set(warning = FALSE, message = FALSE)
```
Run Code Online (Sandbox Code Playgroud)

第一次做时效果很好

.pull-left[
```{r}
y <- data.frame(A = LETTERS[1:5],
            B = 1:5,
            C = sqrt(6:10))
```
]

.pull-right[
Some text in here talking abut indexing, dataframes, accessing stuff 
]
Run Code Online (Sandbox Code Playgroud)

第二次似乎从左栏下方的第二栏开始

.pull-left[
See how the right box is going down

so down.
]

.pull-right[
```{r}
y <- data.frame(A = LETTERS[1:5],
            B = 1:5,
            C = sqrt(6:10))
```

]
Run Code Online (Sandbox Code Playgroud)

Rmarkdown 的输出如下所示

有问题的幻灯片

我应该以不同的方式使用这些功能吗?这看起来像一个错误吗?

use*_*748 3

如果您使用以下命令,它似乎可以工作css: "ninjutsu"

YAML 标头

---
title: "reprex-left.right"
author: "Ramon Gallego"
date: "4/10/2020"
output:
  xaringan::moon_reader:
    css: "ninjutsu"
---
Run Code Online (Sandbox Code Playgroud)

代码块:

    ```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
knitr::opts_chunk$set(warning = FALSE, message = FALSE)
    ```

    ```{css echo=FALSE}
.pull-left {
  float: left;
  width: 44%;
}
.pull-right {
  float: right;
  width: 44%;
}
.pull-right ~ p {
  clear: both;
}
    ```

.pull-left[This is <br> the first text block.]
.pull-right[This is <br> the second <br> text block.]

.pull-left[This <br> is <br>text 3.]
.pull-right[This <br> is <br> <br> text 4.]

.pull-left[
This is text 5.]

.pull-right[This is text 6.]

.pull-left[
    ```{r}
# code #1 (past 6)
y <- data.frame(
    A = LETTERS[1:5],
            B = 1:5,
            C = sqrt(6:10))
    ```
]
.pull-right[This is text 7.]


.pull-right[.full-width[.content-box-yellow[
    ```{r}
# code #2 (past 7)
y <- data.frame(
    A = LETTERS[1:5],
            B = 1:5,
            C = sqrt(6:10))
    ```
]]]
.pull-left[.full-width[.content-box-white[This is text 8.]]]


.pull-left[.full-width[.content-box-white[
    ```{r}
# code #3 (after 8)
y <- data.frame(
    A = LETTERS[1:5],
            B = 1:5,
            C = sqrt(6:10))
    ```
]]]

.pull-right[.full-width[.content-box-white[
    ```{r}
# code #4 (after c3)
y <- data.frame(
    A = LETTERS[1:5],
            B = 1:5,
            C = sqrt(6:10))
    ```
]]]

Run Code Online (Sandbox Code Playgroud)

结果:

桌子