Quarto+R生成PDF时子表格编译报错:Extra }, or forgotten \endgroup
Quarto生成PDF子表格时LaTeX编译错误排查
问题概述
- 使用Quarto结合R撰写学位论文,渲染为PDF时出现编译错误:
ERROR: compilation failed- error Extra }, or forgotten \endgroup. l.3650 } - 渲染HTML和Word格式均正常,仅PDF格式触发报错
- 已定位问题到生成子表格的R代码块,若改为生成单个表格则可正常渲染
- 错误提示的行号
l.3650远大于当前章节的实际行数(约775行),无法直接定位问题位置
出错的子表格代码块
{r, display_aov_tbls} #| label: tbl-aov_tbls_avg_vals #| tbl-cap: ANOVA table of fixed effects for linear mixed effects models. Controlling factors of age, sex, and upper VO~2~ bound are excluded for brevity. * p < 0.05, ** p < 0.01, *** p < 0.001, ns (not significant). #| tbl-subcap: #| - "VT~1~" #| - "RC" #| layout_nrow: 2 kable(aov_tbl_vt1) %>% kable_classic(full_width = FALSE, html_font = "Times New Roman") kable(aov_tbl_vt2) %>% kable_classic(full_width = FALSE, html_font = "Times New Roman")
可正常渲染的单表格代码块
{r, display_aov_tbls} #| label: tbl-aov_tbls_avg_vals #| tbl-cap: ANOVA table of fixed effects for linear mixed effects models. Controlling factors of age, sex, and upper VO~2~ bound are excluded for brevity. * p < 0.05, ** p < 0.01, *** p < 0.001, ns (not significant). kable(aov_tbl_vt1) %>% kable_classic(full_width = FALSE, html_font = "Times New Roman")
疑问
- 此问题属于软件bug,还是可通过调整LaTeX、Quarto、R或Pandoc的深层配置解决?
- 目前使用了自定义
.tex文件和_quarto.yml配置以满足学校格式要求,可提供相关配置信息协助排查
内容的提问来源于stack exchange,提问作者a.hesse
相关产品推荐
相关产品推荐

