1

I am trying to knit a document to pdf. I can knit to HTML just fine, but the pdf never works. Things I have tried:

  • Update all packages
  • install.packages("tinytex")
    • installs perfectly and shows in in the packages pane
  • tinytex::install_prebuilt()
tlmgr conf auxtrees add "C:/PROGRA~1/R/R-4.0.3/share/texmf"
Error in system2("tlmgr", args, ...) : 
  'CreateProcess' failed to run 'C:\Users\XXX XXX\AppData\Roaming\TinyTeX\bin\win32\tlmgr.bat info --list --only-installed --data name'
  • tinytex:::install_tinytex()
Error in system2("tlmgr", args, ...) : 
  'CreateProcess' failed to run 'C:\Users\XXX XXX\AppData\Roaming\TinyTeX\bin\win32\tlmgr.bat info --list --only-installed --data name'
  • knit button
Error in system2("tlmgr", args, ...) : 
  'CreateProcess' failed to run 'C:\Users\XXX XXX\AppData\Roaming\TinyTeX\bin\win32\tlmgr.bat update --all --self'
Calls: <Anonymous> ... latexmk_emu -> run_engine -> system2_quiet -> tlmgr_update
In addition: Warning message:
In system2(..., stdout = if (use_file_stdout()) f1 else FALSE, stderr = f2) :
  'CreateProcess' failed to run 'C:\Users\XXX XXX\AppData\Roaming\TinyTeX\bin\win32\pdflatex.exe -halt-on-error -interaction=batchmode "Document.tex"'
Execution halted
  • Complete uninstall and reinstall of R and RStudio

I'm at a loss at this point and nothing I have found online has worked.

Metadata sections:

Without xelatex

---
title: "A Document"
output: pdf_document
---
Error in system2("tlmgr", args, ...) : 
  'CreateProcess' failed to run 'C:\Users\XXX XXX\AppData\Roaming\TinyTeX\bin\win32\tlmgr.bat update --all --self'
Calls: <Anonymous> ... latexmk_emu -> run_engine -> system2_quiet -> tlmgr_update
In addition: Warning message:
In system2(..., stdout = if (use_file_stdout()) f1 else FALSE, stderr = f2) :
  'CreateProcess' failed to run 'C:\Users\XXX XXX\AppData\Roaming\TinyTeX\bin\win32\pdflatex.exe -halt-on-error -interaction=batchmode "Document.tex"'
Execution halted

With xelatex

---
title: "A Document"
output:
   pdf_document:
     latex_engine: xelatex
---
Error in system2("tlmgr", args, ...) : 
  'CreateProcess' failed to run 'C:\Users\XXX XXX\AppData\Roaming\TinyTeX\bin\win32\tlmgr.bat update --all --self'
Calls: <Anonymous> ... latexmk_emu -> run_engine -> system2_quiet -> tlmgr_update
In addition: Warning message:
In system2(..., stdout = if (use_file_stdout()) f1 else FALSE, stderr = f2) :
  'CreateProcess' failed to run 'C:\Users\XXX XXX\AppData\Roaming\TinyTeX\bin\win32\xelatex.exe -halt-on-error -interaction=batchmode "xelatex.tex"'
Execution halted
Emily
  • 46
  • 1
  • 4
  • I've faced this problem and gave up after an hour - I ended up knitting to html then using a converter as a workaround (e.g. https://html2pdf.com/) – jared_mamrot Oct 26 '20 at 02:56
  • One thing to try is to change the engine. in your yaml put ` pdf_document: latex_engine: xelatex` .. look at one of the rmarkdown cheatsheets for the spacing. – Elin Oct 26 '20 at 03:39
  • Also this may help https://stackoverflow.com/questions/57829865/unable-to-knit-pdf-receiving-tinytex-error-with-failed-tlmgr-search?rq=1 – Elin Oct 26 '20 at 04:18
  • Could you include your metadata section in the question? – Dayne Oct 26 '20 at 04:28
  • I updated the post above. Some things to mention - I can't even install tinytex so that is a big barrier to even knitting the PDF. I have suspicions it could be because I have a space in my user name, but I do not know how to bypass that. – Emily Oct 26 '20 at 14:07
  • That's weird. I'm unable to reproduce the problem with a space in username on Windows. Could you also provide your `sessionInfo()`? – Yihui Xie Oct 27 '20 at 20:34
  • Another way to bypass this issue is to download TinyTeX to a specific folder in a directory that doesn't contain spaces. I downloaded it to my C: drive and now it works. – Emily Oct 27 '20 at 21:52
  • Okay. Good to know. It will still be great if you could provide your `sessionInfo()` in the post, so we could try to reproduce the problem with the appropriate environment (Windows 10?). – Yihui Xie Oct 29 '20 at 15:35

1 Answers1

2

The issue was with my file path having a space in it. I went to a different user on my computer which didn't have any spaces and the file converted to a PDF just fine.

Emily
  • 46
  • 1
  • 4