Rmarkdown - 如何去除输出的灰色背景 [英] Rmarkdown - how to remove grey background on output

查看:95
本文介绍了Rmarkdown - 如何去除输出的灰色背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个有点恼人的问题,即我无法从输出中删除灰色文本(请参见下图).

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

我知道这可以通过只使用一个`"以某种方式绕过,但我需要三个```"来运行我的代码解释行.

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

解决方案

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

这篇关于Rmarkdown - 如何去除输出的灰色背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆