Not all latex packages are working when compiling the documents via shinyapps.io

282 views
Skip to first unread message

Wiktor Owczarz

unread,
May 6, 2016, 5:21:16 AM5/6/16
to Shiny - Web Framework for R
Hi all I am new here but I have question that is bothering me for long time already, it is related to creation of the PDF's via Shiny and knit r.

I build shiny app that is expected to create PDF report out of the user input data, through knitr. My application is working perfectly when run on my computer through R Studio but once I upload it to the shiny server (shinyapps.io) some latex packages that I use stop working and I do not understand why. Using eso-pic or hyperref result in error:

Running ' texi2div ' on ' pdf_shell.tex ' failed.

To solve this problem I tried to use
 xelatex compiler when compiling the PDF but it did not solve all of my problems. My problem is mainly related to the hyperref package which is functioning well when run through the R Studio but crash or covers text when run through shiny server. Below you will find pictures visualizing my problem with hyperref (one is compiled through R Studio (working well) and the "broken" via deployed app on shinyapps.io).
Does anyone know how I could compile the PDF using default compiler pdflatex, without getting the above mentioned error? Or you maybe have any pro tips that could solve the problems differently. Any input is much appreciated.

I compile documents via shiny simply with:

output$report = downloadHandler(
filename
= reactive({paste0(input$filename,'.pdf')}),

content
= function(file) {
out = knit2pdf(input = 'pdf_shell.Rnw')
 file.rename(out, file)
 
},

contentType
= 'application/pdf' )

Thank you,

Wiktor
Capture.PNG
Captureq.PNG

Yihui Xie

unread,
May 12, 2016, 1:44:20 AM5/12/16
to Wiktor Owczarz, Shiny - Web Framework for R
I cannot reproduce your issue with the following minimal LaTeX
example, and I guess eso-pic and hyperref must have been installed,
although I'm not sure about their versions (AFAIK we are using a very
old version of TeXLive there, and that might be the problem):

\documentclass{article}
\usepackage{eso-pic}
\usepackage{hyperref}
\begin{document}
foo
\end{document}

It will be easier for us to diagnose the issue if you can provide a
minimal reproducible example.

Regards,
Yihui
> --
> You received this message because you are subscribed to the Google Groups
> "Shiny - Web Framework for R" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to shiny-discus...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/shiny-discuss/32646f93-bbd4-404a-afab-cd65742b22bd%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

Wiktor Owczarz

unread,
May 12, 2016, 4:35:08 AM5/12/16
to Shiny - Web Framework for R, wiktor....@gmail.com
Thank you for your response. Below you will find example of an app that I encounter the error with hyperref covering text. Please note that when I run app through R studio everything is functioning well only when I deploy it on shinyapps.io the error is visible.

server:
shinyServer(function(input, output) {

 
  output$report
= downloadHandler(
    filename
= reactive({paste0(input$filename,'.pdf')}),
   
    content
= function(file) {

     
out = knit2pdf(input = 'pdf_test.Rnw', compiler = 'xelatex')
      file
.rename(out, file) # move pdf to file for downloading

   
},
   
    contentType
= 'application/pdf'
 
)
}
)

ui:
library(shiny)
library
(knitr)

shinyUI
(fluidPage(
  fluidRow
(
    column
(3,
           wellPanel
(
             textInput
('filename', 'File name', value = ''),
             downloadButton
('report', label = 'Download PDF')
           
)
   
)
 
)
)
)


.Rnw:
\documentclass{article}
\usepackage{eso-pic}
\usepackage{hyperref}
\begin{document}
foo

\begin{Form}
\section{Form}
     
\TextField[name=1, multiline=true, width=\linewidth,height=0.6in, bordercolor = 1 1 1, charsize=0pt]{} \\

     
\TextField[name=12, multiline=true, width=\linewidth,height=0.6in, bordercolor = 1 1 1, charsize=0pt]{} \\

     
\TextField[name=13, multiline=true, width=\linewidth,height=0.6in, bordercolor = 1 1 1, charsize=0pt]{}
     
\end{Form}
     
     
\end{document}

If you have any more questions please let me know. Thank you for you help.


Capture.PNG
Capture.PNG

Joshua Spiewak

unread,
May 12, 2016, 10:22:47 AM5/12/16
to Yihui Xie, Wiktor Owczarz, Shiny - Web Framework for R
shinyapps.io currently has texlive-xetex and texlive-latex-recommended version 2009-15 because that is what is available for Ubuntu 12.04.
When we upgrade to Ubuntu 14.04 (real soon now) version 2013.20140215-1 will be used.
--
    -- Josh

Wiktor Owczarz

unread,
May 12, 2016, 10:48:42 AM5/12/16
to Shiny - Web Framework for R, yi...@rstudio.com, wiktor....@gmail.com

@Joshua Spiewak to make it crystal clear, when shinyapps.io will upgrade to Ubuntu 14.04 I can expect the my problem will no longer exist, yes? I am asking because I am not fully familiar with limitations of the texlive-latex-recommended version 2009-15.

Thank you!

Yihui Xie

unread,
May 14, 2016, 3:28:25 AM5/14/16
to Wiktor Owczarz, Shiny - Web Framework for R
We probably cannot guarantee that. I was only guessing TeXLive 2009
might be the problem, and I didn't really test it on Ubuntu 12.04 and
TeXLive 2009. What is your local LaTeX distribution?

Regards,
Yihui
Reply all
Reply to author
Forward
0 new messages