【问题标题】:Shiny App ! LaTeX Error: File `unicode-math.sty' not found闪亮的应用程序! LaTeX 错误:找不到文件“unicode-math.sty”
【发布时间】:2020-08-06 01:02:00
【问题描述】:

我创建了一个闪亮的应用程序,用 knitr 和 rmarkdown 生成可下载的 pdf 报告。

我可以在 Rstudio 中生成报告,但是当我尝试从应用程序生成报告时,我收到了以下错误:

2020-04-22T19:40:03.590795+00:00 shinyapps[2124372]: cannot setup TLPDB in /home/shiny/texmf at /usr/bin/tlmgr line 5604.
2020-04-22T19:40:03.593636+00:00 shinyapps[2124372]: Warning in system2("tlmgr", args, ...) :
2020-04-22T19:40:03.593638+00:00 shinyapps[2124372]:   running command ''tlmgr' search --file --global '/unicode-math.sty'' had status 2
2020-04-22T19:40:03.594869+00:00 shinyapps[2124372]: ! LaTeX Error: File `unicode-math.sty' not found.
2020-04-22T19:40:03.594871+00:00 shinyapps[2124372]: 
2020-04-22T19:40:03.594872+00:00 shinyapps[2124372]: ! Emergency stop.
2020-04-22T19:40:03.594873+00:00 shinyapps[2124372]: <read *> 
2020-04-22T19:40:03.594873+00:00 shinyapps[2124372]: 
2020-04-22T19:40:03.597624+00:00 shinyapps[2124372]: Warning: Error in : LaTeX failed to compile /tmp/RtmpDEOSFT/fileca7f657fa3.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See fileca7f657fa3.log for more info.
2020-04-22T19:40:03.602043+00:00 shinyapps[2124372]:   [No stack trace available]

调试提示建议重新安装 tinytex,所以我尝试了一下。我还将 unicode-math.sty 单独下载到我闪亮的应用程序文件夹并重新部署,但都没有帮助。有什么建议吗?

【问题讨论】:

  • 我们能看到你的代码吗,例如在 github 上?
  • 给你:github.com/jvanzalk/easy-engagement-reports 我刚刚创建了存储库,所以它有点简单。如果您需要澄清任何事情,请告诉我。刚刚想到的一个想法是为丢失的 tex 包创建一个目录,就像我为 OpenSans 所做的那样。知道这是否可行吗?谢谢!
  • 仅作记录,后来交叉发布到github.com/yihui/tinytex/issues/205

标签: shiny r-markdown knitr shinyapps tinytex


【解决方案1】:

我也遇到了同样的问题,但找不到解决方案。请使用以下解决方案来解决此问题。

转到安装 tex 包的文件夹,该文件夹很可能位于 C:\Users\vksharma\AppData\Roaming\TinyTeX\texmf-dist\tex\latex\unicode-math。复制所有四个文件,即

进入你的工作目录。然后编写以下代码,其中您已呈现降价 pdf:

      tempsty <- file.path(tempdir(), "unicode-math.sty")
      file.copy("unicode-math.sty", tempsty, overwrite = TRUE)
      tempxesty <- file.path(tempdir(), "unicode-math-xetex.sty")
      file.copy("unicode-math-xetex.sty", tempxesty, overwrite = TRUE)
      tempxesty1 <- file.path(tempdir(), "unicode-math-table.tex")
      file.copy("unicode-math-table.tex", tempxesty, overwrite = TRUE)
      tempxesty2 <- file.path(tempdir(), "unicode-math-luatex.sty")
      file.copy("unicode-math-luatex.sty", tempxesty, overwrite = TRUE)

它所做的基本上是将这些文件从你的工作目录复制到 shinyapps 服务器的临时目录,然后在渲染 markdown 时,它会搜索这些包并安装它们。

编码愉快!

【讨论】:

    猜你喜欢
    • 2015-10-18
    • 1970-01-01
    • 2017-05-27
    • 2013-07-02
    • 2018-05-24
    • 2018-10-13
    • 2022-01-23
    • 2021-08-06
    • 1970-01-01
    相关资源
    最近更新 更多