Rmarkdown - how to remove grey background on output

不问归期 提交于 2019-12-06 14:07:58

问题


I am experiencing a slightly irritating problem, which is that I am not able to remove the grey text from output (please see picture below).

I've searched for a solution, but is restricted by my lack of knowledge about the proper terms, and therefore I am not able to find any solutions.

I know this can be somehow bypassed by using only one "`", yet I need the triple "```" in order to run my code interpreting rows.

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:


You might simply want to override the grey highlighting in the YAML header as follows:

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

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

Now if you want to get rid of the "##" and the line-numbers, tell knitr to handle texts as-is, and use cat():

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

Et voilà:



来源:https://stackoverflow.com/questions/45862802/rmarkdown-how-to-remove-grey-background-on-output

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!