简体   繁体   中英

How to change the strip color on kableExtra

The color of the strips are very lite on Kable on Pdf output. So is there a way to change the color on kable_styling(latex_options = "striped") ?

The author of the kableExtra package @hao was kind to add this option. The answer can be found on change the strip color on 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:

In the 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. Assuming my dataframe for the table is called df :

kable(df, format = "latex", booktabs=TRUE) %>%
    kable_styling(latex_options = "striped", stripe_color="ltgray")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM