本文介绍了垂直对齐电缆的列名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设下一个示例:
library(knitr)
library(kableExtra)
df <- data.frame(a = letters[1:10], b = 1:10)
names(df) <- c("This is a looooooong title, I don't know how to handle this... Also, I'm trying to extend this title even more... This column name will be used to compute vertical space","I want to align vectically this column name")
df %>% kable(format = 'latex', linesep = "", align = 'c') %>% kable_styling(full_width = T)
第二列名称如何垂直对齐?
How can align vertically the second column name?
推荐答案
我不确定是否有更简单的方法,但是可以使用multirow
软件包:
I am not sure if there is an easier way, but you can go with the multirow
package:
---
title: "Test Book"
header-includes:
- \usepackage{multirow}
author: "therimalaya"
output:
pdf_document:
keep_tex: yes
---
# Hello World
```{r, error = TRUE, echo = T}
library(knitr)
library(kableExtra)
df <- data.frame(a = letters[1:10], b = 1:10)
names(df) <- c("This is a looooooong title, I don't know how to handle this... Also, I'm trying to extend this title even more... This column name will be used to compute vertical space","\\multirow{1}{*}[0pt]{I want to align vectically this column name}")
df %>% kable(format = 'latex', linesep = "", align = 'c', escape = F) %>% kable_styling(full_width = T)
```
这篇关于垂直对齐电缆的列名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!