[R] texi2dvi runs but produces no output

David Hewitt dhewitt37 at gmail.com
Thu Apr 8 19:03:25 CEST 2010

I am working on a Windows XP machine with R 2.10.1 and a recent
installation of MiKTeX 2.8. I use LyX (www.lyx.org) to write documents
and have it set up to run Sweave, Stangle, and make the PDF through R
using a batch script and a MakeSweave.R file. This system worked just
fine until I ran some MiKTeX updates yesterday. This is a bit
embarrassing as I helped produce a "How-to" guide to getting this
working that is posted at the LyX Wiki

After the updates yesterday, everything goes smoothly except that the
code in the MakeSweave.R file that runs texi2dvi seems not to produce
a PDF but gives no warnings or errors.

The contents of the batch file are:

Rterm --no-site-file --no-save -f "C:/Program Files/LyX
1.6.5/bin/MakeSweave.R" --args %1

The batch file is called in the temporary directory where LyX does its
work, which is also open to all access. I have to admit that I still
confused on the --args %1 part, but I can see that it works in the
console transcript.

The MakeSweave.R contents are:

args <- commandArgs()
filename <- args[length(args)]
basename <- sub("\\.(Rnw|Rtex|nw)$", "", filename)
texi2dvi(paste(basename, ".tex", sep=""), pdf=TRUE)

I run LyX from a command window and watch what goes on in the
background. All goes fine through the whole process, texi2dvi runs and
finishes, and then LyX pukes an error that it cannot open the PDF
because the PDF does not exist. Indeed, if I check the temp directory
for LyX, all files are present but the PDF. I get no other warnings or
errors from texi2dvi and cannot figure out why this happens.

In case it helps, I can run
and then
texi2dvi("Sweave-test-1.tex", pdf=TRUE)
and the same thing happens. No PDF.

Can someone help me figure out why texi2dvi fails to produce a PDF?

A potential complication (as always) is that I am working in a
non-Admin account on the machine. I can invoke Admin permissions to
change things and had managed to get everything working before.
Permissions may be an issue, but I have set full access to all the
folders involved in this process (R, LyX, MiKTeX bins for example),
and this got it working prior to updates. I am hoping that is not it.
It seems like an issue with texi2dvi.

Dave Hewitt
Research Fishery Biologist
USGS Western Fisheries Research Center
Klamath Falls Field Station, Oregon

More information about the R-help mailing list