【问题标题】:How do I reduce/remove space between list items in my R Markdown code?如何减少/删除 R Markdown 代码中列表项之间的空间?
【发布时间】:2020-10-20 14:38:19
【问题描述】:

好的,所以我正在将我的 R Markdown 编入 Word 文档,并希望尽可能多地删除列表项之间的可用空格。

我使用的代码是:

- The first line.
- The second line.
- The third line.

有人可以帮忙吗?提前致谢。

【问题讨论】:

  • 这可能取决于 knitr 隐式使用的 Word 文档模板中项目列表的样式
  • 你能详细说明一下吗?
  • 添加到user101089所说的,你实际上可以制作一个你想要的word doc模板,然后将模板提供给Rmarkdown并让它塑造成word文档。
  • 关键是在标题中使用reference_docx: my-styles.docx。见:bookdown.org/yihui/rmarkdown/word-document.html

标签: r r-markdown markdown


【解决方案1】:

我们可以在 Rmarkdown 中使用 CSS 来做到这一点!只需添加一个 CSS 块,您就可以控制文本的正文,或任何其他所需的文本。

---
title: "Rmarkdown page"
output: html_document
---

```{css echo = FALSE}
body {line-height: 5;}
```

- item 1
- item 2
- item 3

---
title: "Rmarkdown page"
output: html_document
---

```{css echo = FALSE}
body {line-height: .8;}
```

- item 1
- item 2
- item 3

【讨论】:

  • 不,它不起作用。它仅在我将其编织成 HTML 文件时才有效。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2022-11-22
  • 2020-06-11
  • 2010-11-18
  • 1970-01-01
  • 2021-05-30
  • 2019-06-11
  • 2017-02-09
相关资源
最近更新 更多