Add left border to additional header row in kableExtra

When I add a header row to a table that has left and right outer borders, the border does not extend up through the additional header row. But, for some reason, a border is added on the right even though the rest of the table does not have a right border. Is there a way I can get a border on the left of an additional header row?

This seems like perhaps the opposite issue from issue #280.

---
title: "Untitled"
output: 
  pdf_document
header-includes:
  - \usepackage{makecell}
  - \usepackage{multirow}
---

```{r test, message = FALSE}
library("tidyverse")
library("kableExtra")

## Create data
dat <- tibble(
  x = 1:5,
  y = 6:10
)

dat %>%
  kable("latex", escape = FALSE) %>%
  column_spec(1, border_left = TRUE) %>%
  add_header_above(c("combo" = 2))
```

33%20PM

I am also very interested in a solution for this when knitting to pdf. In a similar scenario, I have used column_spec() to add vlines on both the left and right edges of my table, but they are not extending into an additional header row I have created using add_header_above().

The right border is always added by add_header_above as seen in

I've made changes in my fork to allow for the creation of borders in headers (see below code), but there might be other ways of doing this.

---
title: "Untitled"
output:
  pdf_document: default
header-includes:
- \usepackage{makecell}
- \usepackage{multirow}
---

```{r test, message = FALSE}
library("tidyverse")
library("kableExtra")

## Create data
dat <- tibble(
  x = 1:5,
  y = 6:10
)

dat %>%
  kable(escape = FALSE) %>%
  column_spec(1, border_left = TRUE) %>%
  column_spec(2, border_right = TRUE) %>%
  add_header_above(c("combo" = 2), align = "|c|", escape = FALSE)
```

image

I've opened an issue on GitHub for this.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.