New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDPI option cannot find final pdf output in R v3.5.0 #176

Closed
brentthorne opened this Issue Jun 22, 2018 · 14 comments

Comments

Projects
None yet
4 participants
@brentthorne
Copy link

brentthorne commented Jun 22, 2018

Hello,

I have been using rticles to put together a manuscript for the journal Remote Sensing published through MDPI. I recently updated my desktop to R v3.5.0 and now I get this error when knit:

Output created: Untitled.pdf
Error in tools::file_path_as_absolute(output_file) : 
  file 'Untitled.pdf' does not exist
Calls: <Anonymous> -> <Anonymous>
Execution halted

This error occurs straight from the template default as well when using the New R Markdown which is why the output file is name "Untitled.pdf".

My laptop is still using R v3.4.4 and does not have this issue. Both computers are using the github version of rticles v0.4.2.9000. When I use other journal formats such as Elsiver I do not have this issue on either machine.

I would prefer to have the latest version of R in use while I continue to work on my manuscript and would appreciate if anyone had some advice for me.

Here is the session info for both machines:

Desktop R v3.5.0:

devtools::session_info("rticles")
Session info ------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.5.0 (2018-04-23)
 system   x86_64, mingw32             
 ui       RStudio (1.1.453)           
 language (EN)                        
 collate  English_United States.1252  
 tz       America/New_York            
 date     2018-06-22                  

Packages ----------------------------------------------------------------------------------------
 package   * version    date       source                            
 backports   1.1.2      2017-12-13 CRAN (R 3.5.0)                    
 base64enc   0.1-3      2015-07-28 CRAN (R 3.5.0)                    
 digest      0.6.15     2018-01-28 CRAN (R 3.5.0)                    
 evaluate    0.10.1     2017-06-24 CRAN (R 3.5.0)                    
 glue        1.2.0      2017-10-29 CRAN (R 3.5.0)                    
 graphics  * 3.5.0      2018-04-23 local                             
 grDevices * 3.5.0      2018-04-23 local                             
 highr       0.6        2016-05-09 CRAN (R 3.5.0)                    
 htmltools   0.3.6      2017-04-28 CRAN (R 3.5.0)                    
 jsonlite    1.5        2017-06-01 CRAN (R 3.5.0)                    
 knitr       1.20       2018-02-20 CRAN (R 3.5.0)                    
 magrittr    1.5        2014-11-22 CRAN (R 3.5.0)                    
 markdown    0.8        2017-04-20 CRAN (R 3.5.0)                    
 methods   * 3.5.0      2018-04-23 local                             
 mime        0.5        2016-07-07 CRAN (R 3.5.0)                    
 Rcpp        0.12.16    2018-03-13 CRAN (R 3.5.0)                    
 rmarkdown   1.10.2     2018-06-22 Github (rstudio/rmarkdown@1f5b299)
 rprojroot   1.3-2      2018-01-03 CRAN (R 3.5.0)                    
 rticles     0.4.2.9000 2018-06-19 Github (rstudio/rticles@371fee0)  
 stats     * 3.5.0      2018-04-23 local                             
 stringi     1.2.2      2018-05-02 CRAN (R 3.5.0)                    
 stringr     1.3.1      2018-05-10 CRAN (R 3.5.0)                    
 tinytex     0.5.7      2018-06-22 Github (yihui/tinytex@4fb21ee)    
 tools       3.5.0      2018-04-23 local                             
 utils     * 3.5.0      2018-04-23 local                             
 xfun        0.2.4      2018-06-22 Github (yihui/xfun@6eb610d)       
 yaml        2.1.19     2018-05-01 CRAN (R 3.5.0) 

Laptop R v3.4.4:

devtools::session_info("rticles")
Session info ---------------------------------------------------------------------------
setting  value                       
 version  R version 3.4.4 (2018-03-15)
system   x86_64, mingw32             
 ui       RStudio (1.1.442)           
 language (EN)                        
 collate  English_Canada.1252         
 tz       America/New_York            
 date     2018-06-22                  

Packages -------------------------------------------------------------------------------
package   * version    date       source                          
 backports   1.1.2      2017-12-13 CRAN (R 3.4.3)                  
 base64enc   0.1-3      2015-07-28 CRAN (R 3.4.1)                  
 digest      0.6.15     2018-01-28 CRAN (R 3.4.3)                  
 evaluate    0.10.1     2017-06-24 CRAN (R 3.4.4)                  
 glue        1.2.0      2017-10-29 CRAN (R 3.4.4)                  
 graphics  * 3.4.4      2018-03-15 local                           
 grDevices * 3.4.4      2018-03-15 local                           
 highr       0.6        2016-05-09 CRAN (R 3.4.4)                  
 htmltools   0.3.6      2017-04-28 CRAN (R 3.4.4)                  
 jsonlite    1.5        2017-06-01 CRAN (R 3.4.4)                  
 knitr       1.20       2018-02-20 CRAN (R 3.4.4)                  
 magrittr    1.5        2014-11-22 CRAN (R 3.4.4)                  
 markdown    0.8        2017-04-20 CRAN (R 3.4.4)                  
 methods   * 3.4.4      2018-03-15 local                           
 mime        0.5        2016-07-07 CRAN (R 3.4.1)                  
 Rcpp        0.12.16    2018-03-13 CRAN (R 3.4.4)                  
 rmarkdown   1.9        2018-03-01 CRAN (R 3.4.4)                  
 rprojroot   1.3-2      2018-01-03 CRAN (R 3.4.4)                  
 rticles     0.4.2.9000 2018-06-04 Github (rstudio/rticles@371fee0)
stats     * 3.4.4      2018-03-15 local                           
 stringi     1.1.7      2018-03-12 CRAN (R 3.4.4)                  
 stringr     1.3.0      2018-02-19 CRAN (R 3.4.4)                  
 tools       3.4.4      2018-03-15 local                           
 utils     * 3.4.4      2018-03-15 local                           
 yaml        2.1.19     2018-05-01 CRAN (R 3.4.4)

Thank you.

@yihui yihui added the bug label Jun 22, 2018

@yihui

This comment has been minimized.

Copy link
Member

yihui commented Jun 22, 2018

The MDPI template was introduced by @dleutnant. Any ideas, Dominik?

FWIW, when I tried the default example, I got an error:

! Package pdftex.def Error: File `logo-mdpi-eps-converted-to.pdf' not found: us
ing draft setting.
@dleutnant

This comment has been minimized.

Copy link
Contributor

dleutnant commented Jun 23, 2018

The default example works in my case (R 3.5.0, darwin15.6.0). @yihui Would a more recent RStudio version potentially solve this issue (with a new pandoc) ? I am running RStudio 1.2.471...

@yihui

This comment has been minimized.

Copy link
Member

yihui commented Jun 24, 2018

@dleutnant I'm also running RStudio 1.2.x and R 3.5.0 on the latest version of macOS.

I just searched for the error message and realized it meant the package epstopdf was not installed. After I install it, the template worked for me.

@brentthorne I don't know which LaTeX distribution you are using. You may remove your existing LaTeX distribution and try TinyTeX instead: https://bookdown.org/yihui/rmarkdown/installation.html After TinyTeX is installed, do tinytex::tlmgr_install('epstopdf').

@yihui yihui removed the bug label Jun 24, 2018

@brentthorne

This comment has been minimized.

Copy link
Author

brentthorne commented Jun 24, 2018

I had the same issue as @yihui with my home Ubuntu 16.4 machine this morning which was using TinyTeX, R v3.5.0 and RStudio v1.2.x. The tinytex::tlmgr_install('epstopdf') solution worked on it.

@dleutnant Is there any reason why the epstopdf package doesn't automatically download the way other packages would as needed? Maybe there could be a way to implement that and or make it clear to anyone who wants to use MDPI format that they would have to follow those steps.

I am not at work until Monday to test this out on my desktop machine (which is where the initial problem occurred). Since this work machine is running Windows 10 and is currently set up to use MiKTeX I will wait to close this issue until I can confirm that installing the epstpdf package works on it aswell. I'm curious as to why my work machine didn't have an issue with finding the 'logo-mdpi-eps-converted-to.pdf' file, but then could not find the final output pdf which appears briefly in the directory folder but is then deleted immediately leading to the error :

Output created: Untitled.pdf
Error in tools::file_path_as_absolute(output_file) : 
  file 'Untitled.pdf' does not exist
Calls: <Anonymous> -> <Anonymous>
Execution halted

Thank you both for taking the time to look into my inquiries and also big thank you for the work put into making these awesome tools/ templates for researchers like me to enjoy!

@yihui

This comment has been minimized.

Copy link
Member

yihui commented Jun 25, 2018

FYI: The development version of tinytex can automatically install epstopdf now:

devtools::install_github('yihui/tinytex')
@brentthorne

This comment has been minimized.

Copy link
Author

brentthorne commented Jun 25, 2018

Thanks everyone, I had to reinstall both R and RStudio but that seemed to do the trick in combination with using tinytex and removing MiKTeX.

@caijun

This comment has been minimized.

Copy link

caijun commented Jul 4, 2018

I installed epstopdf by using the development version of tinytex, but still got the error.

tlmgr search --file --global '/epstopdf'
Trying to automatically install missing LaTeX packages...
tlmgr install epstopdf
tlmgr: package repository http://mirrors.ustc.edu.cn/CTAN/systems/texlive/tlnet (not verified: gpg unavailable)
tlmgr install: package already present: epstopdf
tlmgr path add
tlmgr search --file --global '/epstopdf'
! Package pdftex.def Error: File `logo-mdpi-eps-converted-to.pdf' not found: us
ing draft setting.

My session Info is as follows.

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin17.6.0 (64-bit)
Running under: macOS High Sierra 10.13.5

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] tinytex_0.5.11

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17    withr_2.1.2     digest_0.6.15   rprojroot_1.3-2 R6_2.2.2        backports_1.1.2
 [7] git2r_0.21.0    magrittr_1.5    evaluate_0.10.1 httr_1.3.1      stringi_1.2.3   curl_3.2       
[13] rticles_0.4.6   rmarkdown_1.10  devtools_1.13.6 tools_3.5.1     stringr_1.3.1   xfun_0.2.9     
[19] yaml_2.1.19     compiler_3.5.1  memoise_1.1.0   htmltools_0.3.6 knitr_1.20     
@caijun

This comment has been minimized.

Copy link

caijun commented Jul 4, 2018

Did the problem relate to the pdftex option?

%---------
% pdftex
%---------
% The option pdftex is for use with pdfLaTeX. If eps figures are used, remove the option pdftex and use LaTeX and dvi2pdf.
@yihui

This comment has been minimized.

Copy link
Member

yihui commented Jul 4, 2018

@caijun Check if you have Ghostscript installed: Sys.which('gs') should not return an empty string. If not installed, you may install via Homebrew: brew install ghostscript.

@caijun

This comment has been minimized.

Copy link

caijun commented Jul 5, 2018

I have installed Ghostscript via Homebrew, but yesterday I updated R to version 3.5.1. I have set the PATH variable for gs in RStudio. Now it works. Thank you very much.

@yihui

This comment has been minimized.

Copy link
Member

yihui commented Jul 5, 2018

@caijun If your ghostscript was installed via brew, there is no need to adjust PATH, because gs should be found under /usr/local/bin, which should be a standard element of your PATH variable.

@caijun

This comment has been minimized.

Copy link

caijun commented Jul 5, 2018

On my macOS, the path to gs is

/usr/local/Cellar/ghostscript/9.23/bin/gs

not under /usr/local/bin. So I set the PATH variable for gs.

@yihui

This comment has been minimized.

Copy link
Member

yihui commented Jul 5, 2018

Homebrew should make symlinks to /usr/local/bin automatically. If not, there might be something wrong with your Hombrew installation (or try brew link ghostscript).

$ ls -l /usr/local/bin/gs
lrwxr-xr-x  1 yihui  admin  33 Jun 18 22:48 /usr/local/bin/gs -> ../Cellar/ghostscript/9.23/bin/gs
@caijun

This comment has been minimized.

Copy link

caijun commented Jul 5, 2018

Yes, brew link ghostscript did not run successfully because of the permissions of some files. I have fixed the file permissions. Now gs is under /usr/local/bin and the PATH variable to gs has been removed. @yihui Thank you very much.

yihui added a commit to yihui/tinytex that referenced this issue Jul 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment