[英]How to change the strip color on kableExtra
The color of the strips are very lite on Kable
on Pdf output. 在Pdf输出的Kable
上,条带的颜色非常精简。 So is there a way to change the color on kable_styling(latex_options = "striped")
? 那么有没有办法改变kable_styling(latex_options = "striped")
的颜色kable_styling(latex_options = "striped")
?
The author of the kableExtra
package @hao was kind to add this option. kableExtra
包@hao的作者kableExtra
友好地添加了这个选项。 The answer can be found on change the strip color on kableExtra 可以在更改kableExtra上的条带颜色时找到答案
Cobbling together the link provided by @S.Perera above (where @hao states no functionality for hex codes yet), deciding I didn't like the available LaTeX color codes found here (code for modifying just below that), an attempt to change stripe color described here , and my own desire to fine-tune with hex codes, I came up with the following: 将@ S.Perera上面提供的链接拼凑在一起(其中@hao表示还没有针对十六进制代码的功能),决定我不喜欢这里找到的可用的LaTeX颜色代码(用于修改的代码),尝试改变这里描述的条纹颜色,以及我自己想用十六进制代码微调的愿望,我想出了以下内容:
In the YAML: 在YAML中:
---
output:
pdf_document:
latex_engine: xelatex
header-includes: \definecolor{ltgray}{HTML}{D3D3D3}
---
ltgray
is the new name for the color, HTML
is the model (you can also do RGB or CMYK), and D3D3D3
is the hex code for the color I want. ltgray
是颜色的新名称, HTML
是模型(你也可以做RGB或CMYK), D3D3D3
是我想要的颜色的十六进制代码。 Assuming my dataframe for the table is called df
: 假设我的表的数据帧被称为df
:
kable(df, format = "latex", booktabs=TRUE) %>%
kable_styling(latex_options = "striped", stripe_color="ltgray")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.