# R-markdonw error in generating pdf file

"I am having problem in generating pdf output . I have downloaded , installed, checked tinytex, which says "TRUE". Tried various options suggested. Even specified path too. But it gave me error saying no pdflatex. I also downloaded latexmk and run it. But still it says no pdf latex. Any suggestions/help please. I am using PC.

install.packages('tinytex')

tinytex::install_tinytex()

Sys.which("pdflatex")
pdflatex
""
Sys.which("xlelatex")
xlelatex
""
?pdflatex
No documentation for ‘pdflatex’ in specified packages and libraries:
you could try ‘??pdflatex’
?latexmk
No documentation for ‘latexmk’ in specified packages and libraries:
you could try ‘??latexmk’
Sys.which("latexmk")
latexmk
"C:\Users\X\DOCUME~1\R\win-library\3.6\latexmk\latexmk.bat"
tinytex::latexmk()
Error in grepl("[.]tex$", file) : argument "file" is missing, with no default tinytex::pdflatex() Error in grepl("[.]tex$", file) :
argument "file" is missing, with no default
tinytex::tlmgr()
tlmgr
[1] 127
tinytex::lualatex()
Error in grepl("[.]tex\$", file) :
argument "file" is missing, with no default
tinytex::tlmgr_search()
Error in shQuote(what) : argument "what" is missing, with no default

writeLines(c(
'\\documentclass{article}',
'\\begin{document}', 'Hello world!', '\\end{document}'
), 'test.tex')
tinytex::pdflatex('test.tex')



Error: Failed to compile test.tex. See https://yihui.name/tinytex/r/#debugging
for debugging tips.

Thanks

You might be interested in reading through the conversation in this issue on the tinytex GitHub repository, https://github.com/yihui/tinytex/issues/103, which seems to be about something very similar to what you are experiencing.

It looks like some people (but maybe not all) ended up solving the problem via tinytex:::install_prebuilt(), but there were some other suggestions that you might want to try before you get to that point.

@aosmith Thank you so much. I run the prebuilt and tested exactly in the sites.
Now I can see pdf latex and seems ok. But, there is another error now.

"Error: Failed to compile X.tex.
In system2(..., stdout = FALSE, stderr = FALSE) :
'CreateProcess' failed to run 'C:\Users\X\AppData\Roaming\TinyTeX\bin\win32\pdflatex.exe -halt-on-error -interaction=batchmode "X.tex". "

Any idea what it says for? I am bit unfamiliar with error language

thanks
R

Well, I'm glad you made a little progress even if things aren't fixed.

I've never seen that particular error message. Searching the "'CreateProcess failed to run" portion of the error had a few hits but they involved slightly different message (like here) and don't look entirely relevant.

Hopefully someone else will be able to come along and point you in a new direction!

1 Like

Hi,

I had the same issue and the tinytex:::install_prebuilt() fixed it for me!

PJ

1 Like

Thanks. It does fix for me too....but now got another issue

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.