Rmarkdown knit pdf issues!

rmarkdown
rstudio
latex
tinytex

#1

Thank you in advance for any help! I have MikTeX installed on my computer (2.9.6) and the tinytex package but Rmarkdown will not knit to a pdf (it will however for html) no matter what engine I use. I updated the packages and the other solutions seem to suggest downgrading or updating the packages so Im not sure what to do!

Output created: ttest.pdf 
Error in tools::file_path_as_absolute(output_file) : 
file 'ttest.pdf' does not exist
Calls: <Anonymous> -> <Anonymous>
In addition: Warning message:
In readLines(logfile) : incomplete final line found on 'ttest.log'
Execution halted

Session info

> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United 
States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
[1] tinytex_0.5

loaded via a namespace (and not attached):
[1] compiler_3.5.0  backports_1.1.2 magrittr_1.5    rprojroot_1.3-2 
htmltools_0.3.6
[6] tools_3.5.0     yaml_2.1.19     Rcpp_0.12.17    stringi_1.1.7   
rmarkdown_1.10 
[11] knitr_1.20      stringr_1.3.1   digest_0.6.15   evaluate_0.10.1
RMD File
---
title: "ttest"
author: "Erik Maroney"
date: "June 22, 2018"
output: pdf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown

This is an R Markdown document. Markdown is a simple 
formatting syntax for authoring HTML, PDF, and MS Word 
documents. For more details on using R Markdown see 
<http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be 
generated that includes both content as well as the 
output of any embedded R code chunks within the 
document. You can embed an R code chunk like this:

```{r cars}
summary(cars)
```

#2

It sounds like you've been trying a bunch of things, so I'm sorry if this is ground you've already covered, but I wasn't totally sure: did you try uninstalling MikTeX, making sure you're on the latest version of tinytex, and then installing TinyTeX via tinytex::install_tinytex()?

(I know that's a lot of different references to something called tinytex/TinyTeX — tinytex is the R package that contains the function for installing TinyTeX, the custom TeXLive distribution).


#3

Yeah I tried this but it says it finishes (and maybe times out) but when i check if TinyTex exists, it says false...having a lot of trouble with TinyTex


#4

FWIW, I recently tried installing TinyTex and it seemed to hang indefinitely. After I uninstalled MikTeX (from Windows 10 in my case) and started a fresh R session, the install proceeded fine. While tinytex:::is_tinytex() was initially FALSE, it turned to true once I restarted RStudio. Similar to this person's experience...


#5

This is what was on my console when I tried what you did jon

Starting to install TinyTeX to C:\Users\3572974\AppData\Roaming/TinyTeX. It will take a few minutes.
PATH=C:\Users\3572974\AppData\Local\Temp\RtmpEfvNpq\install-tl-20180625\tlpkg\tlperl\bin;C:\Program Files\R\R-3.5.0\bin\x64;C:\Program Files\R\R-3.5.0\bin\x64;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Python36\Scripts\;C:\Program Files\R\R-3.4.1\library\Rtools\bin;C:\Program Files\R\R-3.4.1\library\Rtools\mingw_32\bin;C:\Python36\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\CA\SC\CAWIN\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CA\DSM\bin;C:\Program Files (x86)\CA\SC\CBB\;C:\PROGRA~2\CA\SC\CAM\bin;C:\Program Files (x86)\CA\SC\Csam\SockAdapter\bin;C:\Program Files (x86)\CA\SC\Csam\SockAdapter\bin64;C:\Program Files\MiKTeX 2.9\miktex\bin\x64\;C:\Users\3572974\AppData\Local\Microsoft\WindowsApps;C:\Users\3572974\AppData\Local\atom\bin;C:\Users\3572974\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64\
"C:\Users\3572974\AppData\Local\Temp\RtmpEfvNpq\install-tl-20180625\install-tl" -profile=../texlive.profile
Automated TeX Live installation using profile: ../texlive.profile
cannot contact mirror.ctan.org, returning a backbone server!

#6
Loading http://dante.ctan.org/tex-archive/systems/texlive/tlnet/tlpkg/texlive.tlpdb
C:\Users\3572974\AppData\Local\Temp\RtmpEfvNpq\install-tl-20180625\install-tl: TLPDB::from_file could not download http://dante.ctan.org/tex-archive/systems/texlive/tlnet/tlpkg/texlive.tlpdb;
C:\Users\3572974\AppData\Local\Temp\RtmpEfvNpq\install-tl-20180625\install-tl: maybe the repository setting should be changed.
TinyTeX installed to C:\Users\3572974\AppData\Roaming/TinyTeX
Restart your R session and check if tinytex:::is_tinytex() is TRUE.

Restarting R session...

> tinytex:::is_tinytex()
[1] FALSE
> tinytex:::is_tinytex()
[1] FALSE

#7

On the "cannot contact mirror.ctan.org, returning a backbone server!" message, discussions of returning a backbone server! suggest it may be a network issue
https://tex.stackexchange.com/questions/409037/using-tlmgr-inside-a-linux-nspawn-container
http://tex-live.tug.narkive.com/8crUDRJb/fwd


#8

If you have miktex then taking the following steps may solve the conversion to pdf issue:

  1. Start miktex console.
  2. Click on “Restart as Administrator”.
  3. Click on “settings”.
  4. Then choose “Always install missing packages on the fly”
  5. Close the console.
  6. Restart Rstudio.

Knit to pdf your rmarkdown file.
I hope this solves your issue. (I am assuming you are using Windows operating system).


#9
> tinytex::install_tinytex()
trying URL 'http://mirror.ctan.org/systems/texlive/tlnet/install-tl.zip'
Content type 'application/zip' length 19775481 bytes (18.9 MB)
downloaded 18.9 MB

trying URL 'https://github.com/yihui/tinytex/raw/master/tools/pkgs-custom.txt'
Content type 'text/plain; charset=utf-8' length 275 bytes
downloaded 275 bytes

#10
trying URL 'https://github.com/yihui/tinytex/raw/master/tools/texlive.profile'
Content type 'text/plain; charset=utf-8' length 295 bytes
downloaded 295 bytes

Starting to install TinyTeX to C:\Users\3572974\AppData\Roaming/TinyTeX. It will take a few minutes.
PATH=C:\Users\3572974\AppData\Local\Temp\Rtmp4QYb8o\install-tl-20180813\tlpkg\tlperl\bin;C:\Program Files\R\R-3.5.0\bin\x64;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Python36\Scripts\;C:\Program Files\R\R-3.4.1\library\Rtools\bin;C:\Program Files\R\R-3.4.1\library\Rtools\mingw_32\bin;C:\Python36\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\CA\SC\CAWIN\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CA\DSM\bin;C:\Program Files (x86)\CA\SC\CBB\;C:\PROGRA~2\CA\SC\CAM\bin;C:\Program Files (x86)\CA\SC\Csam\SockAdapter\bin;C:\Program Files (x86)\CA\SC\Csam\SockAdapter\bin64;C:\Users\3572974\AppData\Local\Microsoft\WindowsApps;C:\Users\3572974\AppData\Local\atom\bin
"C:\Users\3572974\AppData\Local\Temp\Rtmp4QYb8o\install-tl-20180813\install-tl" -profile=../texlive.profile
Automated TeX Live installation using profile: ../texlive.profile

Warning messages:
1: In shell("install-tl-windows.bat -profile=../texlive.profile", invisible = FALSE) :
  'install-tl-windows.bat -profile=../texlive.profile' execution failed with error code 99
2: In file.remove("TinyTeX/install-tl.log") :
  cannot remove file 'TinyTeX/install-tl.log', reason 'No such file or directory'
Restart your R session and check if tinytex:::is_tinytex() is TRUE.