本文介绍了黑白文档的代码样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

knitr的优点之一是您可以轻松更改R代码的颜色.但是,大多数文档都以黑白打印.那么在使用黑白打印机打印文档时,R代码的样式设置会是一个很好的设置吗?

One of the nice things about knitr is that you can easily change the colouring of R code. However, most documents are printed in black and white. So would be a good styling setting for R code when printing documents using a black and white printer?

推荐答案

knitr中现在有灰度主题:greyscale0greyscale1greyscale2.您可以通过以下方式查看所有针织主题:

There are now grey scale themes within knitr: greyscale0, greyscale1 and greyscale2. You can view all knitr themes via:

library("knitr")
knit_theme$get()

要在编织文档中设置主题,请添加(例如)行

To set the theme in a knitr document, add (for example) the line

knit_theme$set("greyscale2")

这篇关于黑白文档的代码样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 14:02