When I try to knit Rmd-files to pdf in Rstudio I get an error message. Before summer it worked well, but for about a month now it has not worked. I can still knit to word.
I get the same problem with any Rmd-file, for example this one:
---
title: "Untitled"
output:
pdf_document: default
---
This is a test.
I gave the computer to IT-support where I work. They reinstalled everything, including Windows 10 and Rstudio. This did not solve the problem. I still got the same error message.
System Information:
RStudio Edition: Desktop
RStudio Version: 1.2.1335.
OS Version: Windows 10
R Version: R i386 3.6.0 and R x64 3.6.0
Also:
Your sessionInfo():
R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding
locale:
[1] LC_COLLATE=Swedish_Sweden.1252 LC_CTYPE=Swedish_Sweden.1252 LC_MONETARY=Swedish_Sweden.1252 LC_NUMERIC=C LC_TIME=Swedish_Sweden.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lmerTest_3.1-0 lme4_1.1-21 Matrix_1.2-17
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 knitr_1.24 splines_3.6.0 MASS_7.3-51.4 munsell_0.5.0 colorspace_1.4-1 lattice_0.20-38 rlang_0.4.0 minqa_1.2.4
[10] tools_3.6.0 grid_3.6.0 gtable_0.3.0 nlme_3.1-139 xfun_0.8 htmltools_0.3.6 yaml_2.2.0 digest_0.6.20 lazyeval_0.2.2
[19] tibble_2.1.3 numDeriv_2016.8-1.1 crayon_1.3.4 nloptr_1.2.1 ggplot2_3.2.1 evaluate_0.14 rmarkdown_1.14 compiler_3.6.0 pillar_1.4.2
[28] scales_1.0.0 boot_1.3-22 pkgconfig_2.0.2
The same error message is reported on stackoverflow, ironically also from UNC.
The nub of the problem is that pandoc is trying to fetch the required \LaTeX style file over an HTTP connection. Either the proxy server, if there is one, or the target server doesn't recognize the request because pandoc doesn't automatically include a request-header User-Agent= ... (at least)
So, it's a configuration problem with the \LaTeX installation, which is where default-1.17.0.2.tex lives. I'm not sure what UNC did to point pandoc to the default-1.17.0.2.tex file over an HTTP connection.
Thank you @technocrat for your answer. In the link to stackoverflow that you sent I read that I should "remove the package 'rmarkdown', and reinstall it". I have now removed rmarkdown by writing remove.packages('rmarkdown') and then installed it again by writing install.packages('rmarkdown'). I still have the same problem and get the same error message...
Sorry that I was unclear; my link was just to show that a similar problem had come up involving UNC. The default pandoc - \LaTeX configuration is that pandoc looks for the default-1.17.0.2,tex in the local file system. pandoccan find http files, but to do that it has to be configured to pass the minimum required client side http protocol request headers and, in the case of what's probably a password-protected site, login-credentials.
Thank you @cderv for this advise. I have now installed pandoc 2.7.3. The error message has changed as a result. When I try to knit Rmd-files I now get this error message:
processing file: test.Rmd
|.................................................................| 100%
ordinary text without R code
output file: test.knit.md
"C:/Users/rotalk/AppData/Local/Pandoc/pandoc" +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.tex --template "\hig-ad\personal\homes\R\win-library\3.6\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style tango --pdf-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in" --variable "compact-title:yes"
pandoc.exe: \: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1
Execution halted
There is still something of with the fact your libraries are not on a local directory. rmarkdown package is on the shared dir I guess and if you don't get the UNC error, there is still a reading error from this directory.
Maybe the fix in pandoc is not enough. You can check the discussion in the issue to see what they say...