Reputation: 8986
I need to generate a pdf from a tex file, as a temporary file. However I'm facing an error. I believe it's due to the fact that the function tools::texi2dvi
is just a call for the system command with the same name. Since the Rtmp directory just allow R to create files, I can't create the pdf file there.
There's what I'm trying to the, and the error I get:
> tf <- tempfile()
> brew("template.brew", tf)
> tools::texi2dvi(tf)
Error in tools::texi2dvi(tf) :
Running 'texi2dvi' on '/tmp/Rtmp9n4JFU/filea5811e6a32a' failed.
Messages:
/usr/bin/texi2dvi: etex exited with bad status, quitting.
I believe one workaround would be create a new temporary file using tempfile()
and ask tools::texi2dvi
to write the output on it. However I don't know if the system is allowed to edit a file. And also, I couldn't find a way to set tools::texi2dvi
output file.
Does anyone know a workaround?
Thanks!
Upvotes: 3
Views: 1739
Reputation: 32391
TeX is apparently confused by the lack of file extension. The following should work.
tf <- tempfile(fileext=".tex")
cat(
"\\documentclass{minimal}\\begin{document}test\\end{document}",
file=tf
)
tools::texi2dvi(tf)
Upvotes: 2