如何强制kableExtra中的线路破坏逃脱= false的功能?
在kableExtra> = 0.8.0中, add_header_above 或 pack_rows
是直接添加 \ n
。
但是,这似乎不适用于 etaver = false
参数,如果文本还包含乳胶代码,则需要。
KableExtra中的一个强制线破坏如何使用逃脱= false
?
library(dplyr)
library(knitr)
library(kableExtra)
starwars %>%
filter(species == 'Gungan' | species == 'Droid') %>%
arrange(species) %>%
select(name, eye_color) %>%
kbl(booktabs = TRUE) %>%
pack_rows(
index = c(
'The droids: everybody\'s favourite' = 6,
'The Gungans: only beloved of \nthose aged under $3^2$' = 3),
escape = FALSE)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题
问题是您希望逃脱标题的一部分(即休息),而不是逃脱另一部分(即数学代码)。
进一步的并发症
此核心问题进一步复杂化了许多因素:
的解决方案,
这是一个解决方案。这将适用于HTML和乳胶输出,但它不像您的原始代码那样干净,直截了当:
PDF输出
HTML输出
ISSUE
The issue at hand is that you wish to escape part of your header (i.e., the break) and not escape another part (i.e., the math code).
Further Complications
This core issue is further complicated by a number of factors:
A SOLUTION
Here is a solution that will work for both html and LaTeX output, but it is not as clean and straight forward as your original code:
PDF Output
HTML Output
您可以使用
html
线路断开标签< br/>
:You could use
html
line break tag<br/>
: