Alwin
Alwin

Reputation: 361

knit2pdf failing to produce pdf in Shiny Apps

As the title states, I am attempting create a shiny application that can generate a pdf file that a user can then download. (Note that this is not a duplicate question because I have not found a question with a similar error)

In my search for a solution, I found this gist by the Knitr package author: https://gist.github.com/yihui/6091942, which I am attempting to recreate. There are also questions on S.O that use the same code, out = knit2pdf('input.Rnw', clean = TRUE) but all of them seem to date to before the 3.2.3 release of R.

The error I am given is:

output file: input.tex

Warning: running command '"pdflatex" -interaction=nonstopmode "input.tex"' had status 1
Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,  : 
  unable to run 'pdflatex' on 'input.tex'
Warning: Error in texi2dvi: unable to run 'pdflatex' on 'input.tex'
Stack trace (innermost first):
    52: texi2dvi
    51: tools::texi2pdf
    50: knit2pdf
    49: download$func [D:...\App-2/server.R#44]
     1: shiny::runApp

What I have tried so far:

Updating R, RStudio, knitr package and my TeX distribution (TeXLive). I know that TeXLive is not the issue as I use it daily, and I can create a dummy .Rnw that will compile perfectly using the Compile PDF button in R Studio. I have also tried using knit() or render() and those will generate .tex files without giving an error. I have also changed my working directory to the app folder as suggested by another S.O. question, but that didn't solve my problem either.

Edit, Additional information: I am using Windows 10

Any suggestions welcome!

Upvotes: 1

Views: 883

Answers (1)

pneumatics
pneumatics

Reputation: 2885

I don't think TeXLive is working completely. On Windows, RStudio recommends using MiKTeX, and so does Pandoc.

Upvotes: 1

Related Questions