将字幕添加到R Markdown中的Kablextra
用于在R-Markdown PDF中报告:
我想从所需的点(由于\ n不做工作,我不知道该怎么办)中的标题行()中断标题行),或者在主标题下添加字幕。
```{r}
library(kableExtra)
df <- data.frame(id = c(rep(101, 4), rep(202, 3)),
status = c("a","b","c","d", "a", "b", "c"),
wt = c(100,200,100,105, 20,22,25),
ht = c(5.3,5.2,5,5.1, 4.3,4.2,4.1)
)
df %>%
kbl(caption = "Main Title Main Title Main Title Main Title Main Title
Main Title Main Title Main Title Main Title Main Title Main Title",
align = "c") %>%
kable_styling()
```
任何想法或参考都将受到高度赞赏。
编辑。 如果我添加格式=“ pandoc”
,额外的标头将消失,脚注会失去其样式。
df %>%
kbl(caption = "Main Title Main Title Main Title Main Title \nMain Title
Main Title Main Title Main Title Main Title \nMain Title Main Title",
align = "c",
format = "pandoc") %>%
kable_styling() %>%
add_header_above(c(" ", " ", "params" = 2)) %>%
add_footnote(c("note1", "note2"),
notation = "number")
for reporting in R-Markdown pdf:
I want to either break the title line in kbl() table from the desired point ( which I do not know how to since \n does not do the job) OR add a subtitle under the main title.
```{r}
library(kableExtra)
df <- data.frame(id = c(rep(101, 4), rep(202, 3)),
status = c("a","b","c","d", "a", "b", "c"),
wt = c(100,200,100,105, 20,22,25),
ht = c(5.3,5.2,5,5.1, 4.3,4.2,4.1)
)
df %>%
kbl(caption = "Main Title Main Title Main Title Main Title Main Title
Main Title Main Title Main Title Main Title Main Title Main Title",
align = "c") %>%
kable_styling()
```
Any idea or reference will be highly appreciated.
EDIT. If I add format="pandoc"
, the extra header will disappear and footnote loses its style.
df %>%
kbl(caption = "Main Title Main Title Main Title Main Title \nMain Title
Main Title Main Title Main Title Main Title \nMain Title Main Title",
align = "c",
format = "pandoc") %>%
kable_styling() %>%
add_header_above(c(" ", " ", "params" = 2)) %>%
add_footnote(c("note1", "note2"),
notation = "number")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用字幕软件包和
easce = false
您可以直接将latex用于字幕
参数以获取字幕...通过说明:
\\\\\
创建一个线路断开\\
是逃脱乳胶ScriptSize
:它可以让应用程序知道这是设置字体大小的乳胶命令。如果您不需要更改字体大小,则只需错过\\ scriptsize
即可。With the caption package and
escape = FALSE
you can use latex directly for thecaption
argument to get a subtitle...By way of explanation:
\\\\
creates a line break\\
is required to escape LaTeXscriptsize
: which lets the application know this is a latex command to set the font size. If you do not need to change the font size then just miss out\\scriptsize
.尝试在您的
kbl
中设置format =“ pandoc”
,并使用\ n
for subtitle,例如:output:output:
Try setting the
format = "pandoc"
in yourkbl
and use\n
for subtitle like this:Output: