编织电缆:来自RNW的PDF中的文本颜色为灰色 [英] knitr kable: Text color in PDF from RNW is grey

查看:72
本文介绍了编织电缆:来自RNW的PDF中的文本颜色为灰色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在RNW文件中使用knitr::kable功能创建表格时,PDF中表格项目的文本颜色看起来是灰色的.

When I create a table using the knitr::kable function within a RNW file, the text color of the table items in the PDF appears to be grey.

我想将其更改为黑色.我该怎么办?

I would like to change this to black. How can I do this?

推荐答案

\documentclass{article}
\begin{document}
<<>>=
  knitr::kable(cars[1:10,]) # grey
@

<<results="asis">>=
  knitr::kable(cars[1:10,]) # black
@
\end{document}

默认情况下,kable的输出将包装在knitrout环境中,其中文本颜色(fgcolor)设置为灰色(rgb: 0.345, 0.345, 0.345).这就是在第一块中发生的事情.

By default, the output of kable will be wrapped in a knitrout environment where the text color (fgcolor) is set to grey (rgb: 0.345, 0.345, 0.345). This is what happens in the first chunk.

使用results="asis",输出不会包装在任何封闭环境中,文本颜色不变(黑色).

With results="asis", the output is not wrapped in any enclosing environment, leaving the text color unchanged (black).

这篇关于编织电缆:来自RNW的PDF中的文本颜色为灰色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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