【问题标题】:knitr::include_graphics() disables slide break operator (---) in xaringan [duplicate]knitr::include_graphics() 禁用 xaringan 中的幻灯片中断运算符 (---) [重复]
【发布时间】:2022-01-05 22:22:02
【问题描述】:

当我使用 knitr::include_graphics() 在 xaringan 幻灯片中包含图像时,我的分页符运算符 (---) 失败,并且下一张幻灯片合并到上一张幻灯片中。

这是一个演示问题的代表:

---
title: "knitr::include_graphics() disables slide break operator (---)"
date: "2022-01-04"
output: xaringan::moon_reader
---

# This slide break will work

---

# But when my slide has an image, the slide break will fail

```{r out.width='30%'}
knitr::include_graphics("hp.jpg")
```

--- 

# This should have been a new slide

```{r out.width='30%'}
knitr::include_graphics("hp.jpg")
```

【问题讨论】:

  • 问题是---后面有个空格,如果去掉空格,一切都应该按预期工作。
  • 确实是问题所在!
  • 我只是喜欢语义上有意义的空白。呃。
  • @DaveArmstrong,作为答案发布? (我认为我不会将其关闭为“由于错字”,因为它确实对其他人来说是一个有用的答案)
  • 当您想在幻灯片中插入水平线时,您需要尾随空格。幻灯片分隔符必须是严格的三个破折号,没有空格。 remark.js 需要有一种方法来区分分隔符和规则。更多信息:yihui.org/en/2018/07/yue-jiang

标签: r xaringan


【解决方案1】:

问题在于 xaringan 对分页符的外观非常挑剔。在上面的示例中,第二个 --- 之后有一个空格,这导致了问题。删除他的空格将修复错误。

【讨论】:

    猜你喜欢
    • 2019-01-18
    • 1970-01-01
    • 2018-12-09
    • 2020-02-11
    • 2020-02-03
    • 2019-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多