You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to vertically align my text in the cell without using collapse_row since it is just a single cell.
The code below creates a table where the first column is top vertical aligned; it would be great if I could choose to have it vertical aligned 'middle'.
Thank for any help you can provide,
matt
---
title: "Untitled"
author: "M. Onimus"
date: "9/13/2019"
output: pdf_document
---
```{r setup, include=FALSE}
library(kableExtra)
knitr::opts_chunk$set(echo = TRUE)
```
```{r, include=FALSE}
testDataFrame <- data.frame(col1 = c('something', 'something'), col2 = c('something that is much longer and i would like the first col to be veritcal aligned, this probably needs to be even longer to get my point across', 'something that is much longer and i would like the first col to be veritcal aligned'), stringsAsFactors = FALSE)
```
```{r}
kable(
testDataFrame,
format = 'latex',
longtable = T,
align = 'c'
) %>%
kable_styling(latex_options = c("repeat_header"), repeat_header_text = "Previous Table Continued", font_size = 9) %>%
column_spec(1, width = "8em", ) %>%
column_spec(c(-1), paste0(45/round(NCOL(testDataFrame),1),"em")) %>%
row_spec(0, bold = TRUE)
```
The text was updated successfully, but these errors were encountered:
@matton2 Just added a new option latex_valign for column_spec. However I don't fully understand how it works. It seems that the only way to middle align the first column is to specify "m" at the second column. 🧐
If anyone can find out a fix, that would be great!
Hello and thank you for this package!!
I would like to vertically align my text in the cell without using
collapse_row
since it is just a single cell.The code below creates a table where the first column is top vertical aligned; it would be great if I could choose to have it vertical aligned 'middle'.
Thank for any help you can provide,
matt
The text was updated successfully, but these errors were encountered: