R 闪亮的服务器错误下载降价 PDF !LaTeX 错误:找不到文件"三部分表x.sty"



我最近开始遇到多个Shiny应用程序的问题,这些应用程序通过下载按钮生成R markdown PDF文档。它们都使用kableExtra包中的kable((和kable_styling((生成表,直到最近,它们都能完美地工作。现在,第一次按下下载按钮将无法下载报告。如果你再按一下按钮,它就会工作。

如果我登录到我公司的RStudio Connect服务器并查看日志,我可以在按下第一个按钮时找到错误条目:

! LaTeX Error: File `threeparttablex.sty' not found.
08/17 18:52:51.399 (GMT)
! Emergency stop.
08/17 18:52:51.399 (GMT)
<read *>
08/17 18:52:51.402 (GMT)
Warning: Error in : LaTeX failed to compile /opt/rstudio-connect/mnt/tmp/RtmpM18u7T/file7dcdd4a7e3ae8.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See file7dcdd4a7e3ae8.log for more info.

这是我的.Rmd文件的YAML头:

---
title: "title"
output: pdf_document
header-includes: 
usepackage{fancyhdr}
usepackage{float}
pagestyle{fancy} 
fancyhead[L]{`r params$docNum`}
fancyhead[C]{`r params$attachNum`}
fancyhead[R]{Report Date `r Sys.Date()`}
fancyfoot[R]{thepage}
fancyfoot[C]{footer text}
AtBeginDocument{letmaketitlerelax}
date: "`r Sys.Date()`"
params:
inputs: NA
power: NA
docNum: NA
attachNum: NA
---

这是表的代码块:

df = params$inputs
df %>% kable(align='cc', format="latex") %>% row_spec(0, bold=TRUE) %>% kable_styling(latex_options = "HOLD_position")

由于问题开始出现在多个应用程序上,其中一些应用程序最近没有更新,这可能是服务器更新的回归错误吗?本地运行时不会出现此问题。有什么变通办法吗?谢谢

以下是其中一个日志的大部分文本。有些条目经过了编辑,但所有相关的细节都应该在那里。

2022/08/16 23:13:40.621159053 Linux distribution: Red Hat Enterprise Linux release 8.6 (Ootpa)
2022/08/16 23:13:40.621187277 Server version: 2022.05.0
2022/08/16 23:13:40.621236478 LANG: en_US.UTF-8
2022/08/16 23:13:40.621315722 Working directory: /opt/rstudio-connect/mnt/app
2022/08/16 23:13:40.622039670 Running content using its packrat R library
2022/08/16 23:13:40.678391327 Using Packrat dir /opt/rstudio-connect/mnt/app/packrat/lib/x86_64-pc-linux-gnu/4.2.0
2022/08/16 23:13:40.692397440 R version: 4.2.0
2022/08/16 23:13:40.692409417 shiny version: 1.7.1
2022/08/16 23:13:40.692428504 httpuv version: 1.6.5
2022/08/16 23:13:40.692451960 rmarkdown version: 2.14
2022/08/16 23:13:40.692464308 knitr version: 1.39
2022/08/16 23:13:40.692521462 jsonlite version: 1.8.0
2022/08/16 23:13:40.692526564 RJSONIO version: (none)
2022/08/16 23:13:40.692561850 htmltools version: 0.5.2
2022/08/16 23:13:40.692576277 reticulate version: (none)
2022/08/16 23:13:40.692822388 Using pandoc: /opt/rstudio-connect/ext/pandoc/2.16
2022/08/16 23:13:41.081473306 Using jsonlite for JSON processing
2022/08/16 23:13:41.085340113 Using Shiny bookmarking base directory /opt/rstudio-connect/mnt/bookmarks
2022/08/16 23:13:41.085576000 
2022/08/16 23:13:41.085591088 Starting R with process ID: '510456'
2022/08/16 23:13:41.086031098 Shiny application starting ...
2022/08/16 23:13:41.150073754 
2022/08/16 23:13:41.150084918 Attaching package: ‘shinyjs’
2022/08/16 23:13:41.150133560 
2022/08/16 23:13:41.150723688 The following object is masked from ‘package:shiny’:
2022/08/16 23:13:41.150731839 
2022/08/16 23:13:41.150752714     runExample
2022/08/16 23:13:41.150758183 
2022/08/16 23:13:41.151013087 The following objects are masked from ‘package:methods’:
2022/08/16 23:13:41.151021527 
2022/08/16 23:13:41.151041274     removeClass, show
2022/08/16 23:13:41.151044798 
2022/08/16 23:13:41.878988529 
2022/08/16 23:13:41.879003918 Attaching package: ‘dplyr’
2022/08/16 23:13:41.879040092 
2022/08/16 23:13:41.879340055 The following objects are masked from ‘package:data.table’:
2022/08/16 23:13:41.879348537 
2022/08/16 23:13:41.879364473     between, first, last
2022/08/16 23:13:41.879366255 
2022/08/16 23:13:41.879636271 The following objects are masked from ‘package:stats’:
2022/08/16 23:13:41.879643131 
2022/08/16 23:13:41.879658496     filter, lag
2022/08/16 23:13:41.879660411 
2022/08/16 23:13:41.879945558 The following objects are masked from ‘package:base’:
2022/08/16 23:13:41.879956835 
2022/08/16 23:13:41.879999703     intersect, setdiff, setequal, union
2022/08/16 23:13:41.879999703 
2022/08/16 23:13:42.066010805 
2022/08/16 23:13:42.066025975 Listening on http://127....
2022/08/16 23:40:04.729421935 processing file: report.Rmd
2022/08/16 23:40:04.750732112 
|                                                                            
|                                                                      |   0%
|                                                                            
|..............                                                        |  20%
2022/08/16 23:40:04.750972879    inline R code fragments
2022/08/16 23:40:04.750981585 
2022/08/16 23:40:04.753104689 
|                                                                            
|............................                                          |  40%
2022/08/16 23:40:04.754435440 label: setup (with options) 
2022/08/16 23:40:04.757149131 List of 1
2022/08/16 23:40:04.758069301  $ include: logi FALSE
2022/08/16 23:40:04.758117631 
2022/08/16 23:40:04.952992184 
|                                                                            
|..........................................                            |  60%
2022/08/16 23:40:04.953039222   ordinary text without R code
2022/08/16 23:40:04.953043571 
2022/08/16 23:40:04.953190479 
|                                                                            
|........................................................              |  80%
2022/08/16 23:40:04.953667027 label: unnamed-chunk-1 (with options) 
2022/08/16 23:40:04.953887403 List of 2
2022/08/16 23:40:04.954599108  $ echo   : logi FALSE
2022/08/16 23:40:04.955152760  $ results: chr "asis"
2022/08/16 23:40:04.955217206 
2022/08/16 23:40:04.975045837 
|                                                                            
|......................................................................| 100%
2022/08/16 23:40:04.975104631    inline R code fragments
2022/08/16 23:40:04.975113733 
2022/08/16 23:40:04.976269863 
2022/08/16 23:40:04.976804936 output file: report.knit.md
2022/08/16 23:40:04.976811946 
2022/08/16 23:40:04.982490875 /opt/rstudio-connect/ext/pandoc/2.16/pandoc +RTS -K512m -RTS report.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output /opt/rstudio-connect/mnt/tmp/RtmpN4ih69/file7c9f83f020195.tex --lua-filter /opt/rstudio-connect/mnt/packrat/4.2.0/v2/library/rmarkdown/cc514dae1dc452ec2ffd6d170a462b27/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /opt/rstudio-connect/mnt/packrat/4.2.0/v2/library/rmarkdown/cc514dae1dc452ec2ffd6d170a462b27/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --include-in-header /opt/rstudio-connect/mnt/tmp/RtmpN4ih69/rmarkdown-str7c9f87b29aa3.html --variable 'geometry:margin=1in' --include-in-header /opt/rstudio-connect/mnt/tmp/RtmpN4ih69/rmarkdown-str7c9f85a4f1d1f.html 
2022/08/16 23:40:05.230413483 ! LaTeX Error: File `threeparttablex.sty' not found.
2022/08/16 23:40:05.230426416 
2022/08/16 23:40:05.230458062 ! Emergency stop.
2022/08/16 23:40:05.230463687 <read *> 
2022/08/16 23:40:05.230466903 
2022/08/16 23:40:05.232558162 Warning: Error in : LaTeX failed to compile /opt/rstudio-connect/mnt/tmp/RtmpN4ih69/file7c9f83f020195.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See file7c9f83f020195.log for more info.
2022/08/16 23:40:05.237383668   [No stack trace available]
2022/08/16 23:40:07.491929273 
2022/08/16 23:40:07.526957743 
2022/08/16 23:40:07.526969314 
2022/08/16 23:40:07.527002957 processing file: report.Rmd
2022/08/16 23:40:07.530474230 
|                                                                            
|                                                                      |   0%
|                                                                            
|..............                                                        |  20%
2022/08/16 23:40:07.530547565    inline R code fragments
2022/08/16 23:40:07.530557189 
2022/08/16 23:40:07.531704015 
|                                                                            
|............................                                          |  40%
2022/08/16 23:40:07.532260821 label: setup (with options) 
2022/08/16 23:40:07.532547453 List of 1
2022/08/16 23:40:07.533362326  $ include: logi FALSE
2022/08/16 23:40:07.533410226 
2022/08/16 23:40:07.543254592 
|                                                                            
|..........................................                            |  60%
2022/08/16 23:40:07.543308845   ordinary text without R code
2022/08/16 23:40:07.543319594 
2022/08/16 23:40:07.543449383 
|                                                                            
|........................................................              |  80%
2022/08/16 23:40:07.543957217 label: unnamed-chunk-1 (with options) 
2022/08/16 23:40:07.544151165 List of 2
2022/08/16 23:40:07.544823050  $ echo   : logi FALSE
2022/08/16 23:40:07.545338225  $ results: chr "asis"
2022/08/16 23:40:07.545367461 
2022/08/16 23:40:07.561593854 
|                                                                            
|......................................................................| 100%
2022/08/16 23:40:07.561652341    inline R code fragments
2022/08/16 23:40:07.561661055 
2022/08/16 23:40:07.562346452 
2022/08/16 23:40:07.562694155 output file: report.knit.md
2022/08/16 23:40:07.562701953 
2022/08/16 23:40:07.566077948 /opt/rstudio-connect/ext/pandoc/2.16/pandoc +RTS -K512m -RTS report.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output /opt/rstudio-connect/mnt/tmp/RtmpN4ih69/file7c9f87897ecb1.tex --lua-filter /opt/rstudio-connect/mnt/packrat/4.2.0/v2/library/rmarkdown/cc514dae1dc452ec2ffd6d170a462b27/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /opt/rstudio-connect/mnt/packrat/4.2.0/v2/library/rmarkdown/cc514dae1dc452ec2ffd6d170a462b27/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --include-in-header /opt/rstudio-connect/mnt/tmp/RtmpN4ih69/rmarkdown-str7c9f825c4e9d1.html --variable 'geometry:margin=1in' 
2022/08/16 23:40:08.119471472 
2022/08/16 23:40:08.119476730 Output created: /opt/rstudio-connect/mnt/tmp/RtmpN4ih69/file7c9f87897ecb1.pdf
2022/08/17 00:42:54.010170903 [rsc-session] Received signal: interrupt
2022/08/17 00:42:54.010195999 [rsc-session] Terminating subprocess with SIGINT ...
2022/08/17 00:42:54.020537199 
2022/08/17 00:42:54.020599720 
2022/08/17 00:42:54.022139380 Shiny application exiting ...
2022/08/17 00:42:54.022171284 Execution halted
2022/08/17 00:42:54.057547463 [rsc-session] Terminated subprocess with signal: interrupt

我通过手动安装文件解决了这个问题:从CTAN下载并复制到/usr/share/texlive/texmf-dist/tex/latex/,每个文件都有自己的包名(使用REDHAT,在其他系统中可能不同(。

所以,我有:

/usr/share/texlive/texmf-dist/tex/latex/threeparttablex:
threeparttablex.pdf
threeparttablex.sty
threeparttablex.tex
/usr/share/texlive/texmf-dist/tex/latex/makecell:
makecell.dtx
makecell.pdf
makecell-rus.pdf
makecell-rus.tex
makecell.sty (this one from another source --> https://gitlab.cs.washington.edu/blank/texmf/blob/1247153a1c68e3dddbc20e3e907569812b3849b5/tex/latex/makecell.sty)

然后,执行命令mktexlsr来刷新库/包,就这样!希望它也适用于你。

相关内容

  • 没有找到相关文章

最新更新