Nikolaj
Nikolaj

Reputation: 43

Rmarkdown - how to remove grey background on output

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)
```

Upvotes: 4

Views: 3258

Answers (1)

jay.sf
jay.sf

Reputation: 73272

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à:

enter image description here

Upvotes: 3

Related Questions