You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows下独立R脚本渲染Rmarkdown PDF时LaTeX编译失败求助

R脚本自动渲染RMD生成PDF在Windows上失败(Mac环境正常)

我搭建了一套自动化生成PDF报告的配置:包含.Rmd文件及对应的渲染R脚本,通过每日调度运行该R脚本实现自动生成PDF,这套配置在Mac上运行完全正常。

但迁移到Windows系统后出现问题:

  • 手动编织该.Rmd的变体版本(所有对象值均为显式定义)可以成功生成PDF
  • 运行独立的渲染R脚本时,却抛出**"LaTex failed to compile..."**错误

以下是Windows系统的sessionInfo()输出:

> sessionInfo()
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_Canada.utf8  LC_CTYPE=English_Canada.utf8    LC_MONETARY=English_Canada.utf8 LC_NUMERIC=C                    LC_TIME=English_Canada.utf8    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] patchwork_1.1.2   data.table_1.14.4 DT_0.27           kableExtra_1.3.4  knitr_1.40        readxl_1.4.1      lubridate_1.9.0   timechange_0.1.1 
 [9] rmarkdown_2.18    forcats_0.5.2     stringr_1.4.1     dplyr_1.0.10      purrr_0.3.5       readr_2.1.3       tidyr_1.2.1       tibble_3.1.8     
[17] ggplot2_3.4.0     tidyverse_1.3.2  

loaded via a namespace (and not attached):
 [1] svglite_2.1.1       assertthat_0.2.1    digest_0.6.30       utf8_1.2.2          R6_2.5.1            cellranger_1.1.0    backports_1.4.1     reprex_2.0.2       
 [9] evaluate_0.18       httr_1.4.4          pillar_1.8.1        rlang_1.0.6         googlesheets4_1.0.1 rstudioapi_0.14     labeling_0.4.2      webshot_0.5.4      
[17] googledrive_2.0.0   htmlwidgets_1.5.4   tinytex_0.45        munsell_0.5.0       broom_1.0.1         compiler_4.2.2      modelr_0.1.10       xfun_0.34          
[25] pkgconfig_2.0.3     systemfonts_1.0.4   htmltools_0.5.3     tidyselect_1.2.0    fansi_1.0.3         viridisLite_0.4.1   crayon_1.5.2        tzdb_0.3.0         
[33] dbplyr_2.2.1        withr_2.5.0         grid_4.2.2          jsonlite_1.8.3      gtable_0.3.1        lifecycle_1.0.3     DBI_1.1.3           magrittr_2.0.3     
[41] scales_1.2.1        cli_3.4.1           stringi_1.7.8       farver_2.1.1        fs_1.5.2            xml2_1.3.3          ellipsis_0.3.2      generics_0.1.3     
[49] vctrs_0.5.0         tools_4.2.2         glue_1.6.2          hms_1.1.2           fastmap_1.1.0       yaml_2.3.6          colorspace_2.0-3    gargle_1.2.1       
[57] rvest_1.0.3         haven_2.5.1    

我还保留了运行独立R脚本时控制台的异常信息截图及LaTeX日志截图,可作为排查线索。若需要更多细节,请告知。

内容的提问来源于stack exchange,提问作者zmcclean

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 01:37:14