gpt4 book ai didi

使用 .pull-left[] 在两列中的 Rmarkdown 不起作用两次

转载 作者:行者123 更新时间:2023-12-04 11:39:54 26 4
gpt4 key购买 nike

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

YAML header

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

你第一次做它工作正常
.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
]

第二次似乎从左列下方的第二列开始
.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))
```

]

Rmarkdown 的输出看起来像这样

Probelamtic slide

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

最佳答案

如果您使用 css: "ninjutsu" 似乎可以工作:

YAML header

---
title: "reprex-left.right"
author: "Ramon Gallego"
date: "4/10/2020"
output:
xaringan::moon_reader:
css: "ninjutsu"
---

代码块:
    ```{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))
```
]]]


结果:

table

关于使用 .pull-left[] 在两列中的 Rmarkdown 不起作用两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61150496/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com