刘辉
Rmarkdown使用Ctex knit报! Dimension too large.错误
2025-3-25 11:02
阅读:537

! Dimension too large. \LT@max@sel #1#2->{\ifdim #2=\wd \tw@                                        #1\else \number \c@LT@chunks \fi }{\th... l.518 \end{longtabu}                      I can't work with sizes bigger than about 19 feet. Continue and I'll use the largest value I can.   Here is how much of TeX's memory you used:  21898 strings out of 475847  440248 string characters out of 5773439  953357 words of memory out of 5000000  44482 multiletter control sequences out of 15000+600000  567196 words of font info for 112 fonts, out of 8000000 for 9000  14 hyphenation exceptions out of 8191  93i,9n,114p,396b,937s stack positions out of 10000i,1000n,20000p,200000b,200000s Output written on test.pdf (8 pages).

155812h84n3kg5nda8nuyv.png

我在Rmarkdown中Tinytex使用Ctex模板Knit导出PDF的时候,报错! Dimension too large. 并且导出了残缺的PDF。

根据报错进行debug,发现原因是在Rmarkdown代码中使用了如下代码:

pt <- knitr::kable(results,digits = 3,booktabs=TRUE, caption = '分组正态性检验P值,P>0.05表示符合正态分布') %>% kableExtra::kable_styling(bootstrap_options = "bordered",full_width = T,position = 'center',row_label_position = 'c')

直接将full_width = FALSE即解决了该问题。

可以看到我使用了full_width = TRUE参数,就是这个参数导致了latex处理不了太大的表格。通过查询kableExtra::kable_styling的参考文,对full_width进行了如下说明:

If not specified, a HTML table will have full width by default but this option will be set to FALSE for a LaTeX table

默认都是讲latex表格设定full_width=FALSE的。破案了爽

转载本文请联系原作者获取授权,同时请注明本文来自刘辉科学网博客。

链接地址:https://wap.sciencenet.cn/blog-3587875-1479213.html?mobile=1

收藏

分享到:

当前推荐数:1
推荐人:
推荐到博客首页
网友评论2 条评论
确定删除指定的回复吗?
确定删除本博文吗?