编织电缆:来自RNW的PDF中的文本颜色为灰色 [英] knitr kable: Text color in PDF from RNW is grey
问题描述
当我在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屋!