Tinytex: Shiny App ! LaTeX Error: File `unicode-math.sty' not found

Created on 28 Apr 2020  Â·  10Comments  Â·  Source: yihui/tinytex

Hi,

I created a shiny app to generate a downloadable pdf report with knitr and rmarkdown.

I am able to generate the report in Rstudio, but when I attempt to do so from the app, I get this error:

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]
````

You can find my code at github.com/jvanzalk/easy-engagement-reports

Here's the link to my post on stackoverflow: https://stackoverflow.com/questions/61374767/shiny-app-latex-error-file-unicode-math-sty-not-found

And, here is my session info:

R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS, RStudio 1.2.1335

Locale:
LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 LC_COLLATE=C.UTF-8
LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 LC_PAPER=C.UTF-8 LC_NAME=C
LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C

Package version:
assertthat_0.2.1 cli_2.0.2 compiler_3.6.0 crayon_1.3.4 fansi_0.4.0 glue_1.4.0
graphics_3.6.0 grDevices_3.6.0 methods_3.6.0 rlang_0.4.5 rstudioapi_0.11 stats_3.6.0
tools_3.6.0 utils_3.6.0 xfun_0.13
```

Thanks for your help and let me know if there's anything else that I can provide.


By filing an issue to this repo, I promise that

  • [x] I have fully read the issue guide at https://yihui.org/issue/.
  • [x] I have provided the necessary information about my issue.

    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.

    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('tinytex'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('yihui/tinytex').

    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.

  • [x] I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

Most helpful comment

rstudio/shinyapps-package-dependencies#230 has been fixed. Hopefully texlive-math-extra will be installed on ShinyApps.io soon. Thanks!

All 10 comments

I also encountered the same problem. The local Rstudio can run. The above error occurs when deploying the www.shinyapps.io
How can I solve it?

This is more of a ShinyApps.io issue. Please keep an eye on this thread on the support forum: https://community.rstudio.com/t/58425 Thanks!

@yihui thanks for reaching out to someone on the shiny apps team for us. @zoushucai, in the thread that yihui shared, the issue was resolved by creating a template. I just tried it and it worked for me too! Still interested in seeing what Josh's response is.

I got this error at some point too. Try leaving the template in the same
directory as your app.R and then put the below commands in your app.R
script to create a templates directory and move your templates.tex file
there upon deploying your app.

system('mkdir -p ~/.pandoc/templates')
file.copy("template.tex", "~/.pandoc/templates")

On Fri, May 29, 2020 at 9:14 AM urwa notifications@github.com wrote:

I tried creating the template in the same directory where app.R and
report.Rmd were residing but I got the error Could not find data file
templates/template.tex. I moved it down to templates folder and still the
same error. What am I missing.

My folder heirarchy looks like this:
[image: image]
https://user-images.githubusercontent.com/5441467/83263486-1d9c1e80-a1d8-11ea-8314-8b6e3595e561.png

Any help would be appreciated.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/yihui/tinytex/issues/205#issuecomment-635965463, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AJHKIK4TG5FHBGL72PA2POLRT6YJ3ANCNFSM4MS63SRQ
.

Thanks for the above. This is very helpful.

Hello All,

I have provided the solution for this problem at stackoverflow link. Please follow: https://stackoverflow.com/questions/61374767/shiny-app-latex-error-file-unicode-math-sty-not-found/63301857#63301857

Regards,
Vishal

rmarkdown 1.15 + latex_engine: xelatex + shinyapps.io does work

rmarkdown >1.15 + latex_engine: xelatex + shinyapps.io does not work (adding a template.tex or the .sty files currently does not work)

Please check also https://github.com/rstudio/shinyapps-package-dependencies/issues/230

rstudio/shinyapps-package-dependencies#230 has been fixed. Hopefully texlive-math-extra will be installed on ShinyApps.io soon. Thanks!

Hello everyone. Even though, according to the latest posts, this issue seems to be solved on shinyapps.io, from my shiny app (deployed there) I am still not able to produce a PDF from an .Rmd file embed in the application if the version of the rmarkdown package is higher than 1.15 and the latex engine is xelatex.

When I have this version installed, everything works fine, even though I get the following warning when the application starts:

This version of bslib is designed to work with rmarkdown version 2.7 or higher

If, however, I try to install the latest version of rmarkdown my PDF report is not produced and I get the following LaTeX error:

! LaTeX Error: Missing \begin{document}.
Warning: Error in : LaTeX failed to compile /var/folders/f9/8lfgdj3d5s1dbzsbtscxg9w80000gp/T//RtmpWVpFWz/file10d19ca31140.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See file10d19ca31140.log for more info. [No stack trace available]

Any idea on how to solve this? Thank you for your help!

Hi @nicocriscuolo,

Thanks for reaching out. Please next time open a new issue when yours is not directly related. It is always better to open a new issue, and referenced another that commenting on a closed thread.

I moved your comment into an issue and we can follow up there. thanks !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dlejay picture dlejay  Â·  5Comments

MilesMcBain picture MilesMcBain  Â·  5Comments

matthewgson picture matthewgson  Â·  3Comments

cderv picture cderv  Â·  4Comments

tbradley1013 picture tbradley1013  Â·  7Comments