Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ALL horizontal lines in a table #413

Closed
leynu opened this issue Aug 17, 2019 · 3 comments
Closed

Remove ALL horizontal lines in a table #413

leynu opened this issue Aug 17, 2019 · 3 comments

Comments

@leynu
Copy link

leynu commented Aug 17, 2019

I am trying to create a table with no column names and NO LINES in a PDF output.
I have managed to remove the column names: col.names = NULL.
AND
I can make the last line in the table to "vanish" by making it white: row_spec(nrow(mtcars), extra_latex_after = "\\arrayrulecolor{white}")
BUT
I still have the line on TOP of the table that I can not get ride of :(

This is maybe not the usual scenario but it would be nice to achieve that.
Thanks!

---
title: "test"
output: pdf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(knitr)
library(kableExtra)
```

```{r mtcars, echo=TRUE}
mtcars <- mtcars[1:6, ]
kable(mtcars,  "latex", booktabs = T, col.names = NULL) %>%
  kable_styling( full_width = F, position = "left") %>%
  row_spec(nrow(mtcars), extra_latex_after = "\\arrayrulecolor{white}") %>%
  column_spec(1, width = "5em" ) 
```

@loreabad6
Copy link

Probably not the best solution, but as a workaround, adding this to the YAML does the trick:

---
title: "test"
output: pdf_document
header-includes:
  \usepackage{colortbl}
  \arrayrulecolor{white}
---

@1beb
Copy link

1beb commented May 29, 2020

Also looking for a solution here.

@haozhu233
Copy link
Owner

haozhu233 commented Aug 19, 2020

@loreabad6 @1beb For this problem you can just use some regular expression. There are a lot of regular expression in the latex part of this package so I promise it's a valid solution. ;)

kable(mtcars,  "latex", booktabs = T, col.names = NULL) %>%
  kable_styling( full_width = F, position = "left") %>%
  column_spec(1, width = "5em" ) %>%
  sub("\\\\toprule", "", .) %>%
  sub("\\\\bottomrule", "", .)

Lulliter added a commit to Lulliter/cv_ENG_ITA that referenced this issue Nov 22, 2022
1  Had some issues with the header-includes: LaTeX packages, see haozhu233/kableExtra#413 2 reinstalled vitae from Github
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants