【问题标题】:prevent a list in Rmarkdown阻止 Rmarkdown 中的列表
【发布时间】:2018-01-26 00:05:14
【问题描述】:

我正在使用 Rmarkdown 编写 PDF。我想用(a) 而不创建一个列表来开始一个段落。添加 \(a) 有效,但它突出显示了我的 Rmd 文件文本的其余部分,使其难以阅读。是否有另一种方式表明我不想在 Rmarkdown 中创建列表?

---
title: "Untitled"
output:
  pdf_document: default
  html_document: default
---

This is the first paragraph.

```{r, include=FALSE}
1+1 # nice highlighting before problem
```

(a) This should be the second paragraph. (b) But it is interpreted as a list.

\(a) This slash works to keep the text as a paragraph, but it highlights all remaining text in my Rmd file, which makes it hard to read. (b) Is there another method to use (a) without creating a list?

Here is a good list, but still wrong color in Rmd:

(a) One
(b) Two

```{r, include=FALSE}
1+1 # bad highlighting after problem
```

【问题讨论】:

  • \(a\) 似乎把a 变成了一个特殊字符
  • @MartinSchmelzer 你能告诉我你的默认文本编码设置是什么(Prefs>Code>Saving)吗?也许我们有不同的 RStudio 设置。
  • 是 UTF-8 ...
  • 我错了。重新加载pdf显示它毕竟没有工作......

标签: r r-markdown


【解决方案1】:

尝试将 (a) 放入 <span> 喜欢

<span> (a) </span> This should be the second paragraph.

这有点 hacky,但它适用于 html 和 pdf,它解决了突出显示问题。

【讨论】:

  • 好吧,它有效。对于这样一个不常见的用例,我认为它工作得很好。我将把它打开一段时间,看看是否有其他修复。
猜你喜欢
  • 1970-01-01
  • 2021-05-17
  • 2018-10-25
  • 1970-01-01
  • 1970-01-01
  • 2013-09-26
  • 2022-08-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多