Rmarkdown - 如何删除输出上的灰色背景

时间:2017-08-24 13:21:59

标签: r-markdown

我遇到了一个有点刺激性的问题,就是我无法从输出中删除灰色文本(请参见下图)。

我已经搜索了一个解决方案,但由于我对正确的术语缺乏了解而受到限制,因此我无法找到任何解决方案。

我知道这可以通过仅使用一个“`”以某种方式绕过,但我需要三个“``”才能运行我的代码解释行。

The grey background on output

---
title: "Untitled"
output: word_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

```{r, echo=FALSE}
hej <- ("test")
print(hej)
```

1 个答案:

答案 0 :(得分:0)

您可能只想覆盖YAML标题中的灰色突出显示,如下所示:

---
title: "Untitled"
output: 
   word_document:
      highlight: NULL
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

现在,如果你想摆脱“##”和行号,告诉knitr按原样处理文本,并使用cat()

```{r textfoo, echo = FALSE, results = 'asis'}
hej <- ("test")
cat(hej)
```

Etvoilà:

enter image description here

相关问题