Learn R Programming

lazyWeave (version 2.1.4)

lazy.build: Build PDF Documents for TEX Files

Description

Calls texi2dvi to convert tex code to a pdf.

Usage

lazy.build(tex, pdf=NULL, quiet=TRUE, clean=TRUE, 
    replace=TRUE, ...)

Arguments

tex
Character string giving the location of the TEX code to be built.
pdf
Optional character vector in which to store the built file. If NULL, the pdf will be placed in the same directory as tex.
quiet
Suppresses the output from texi2dvi. When the build is successful, it's just a bunch of noise. When the build is not successful, it will give useful error messages.
clean
Passed to tools::texi2dvi. If TRUE, all auxiliary files are removed (texi2dvi command line option --clean). May not work on some platforms.
replace
Should the current build replace a previous build.
...
Additional arguments to be passed to texi2dvi.

Details

Building with texi2dvi seems to recognize jpeg formats for figures, but not .eps or .ps. I'm certain this is because of something I'm doing wrong and not any limitation of other software. If anyone would care to point out how this could be changed, it'd be greatly appreciated. texi2dvi does accept pdf's very well. My recommendation is to use the pdf function for graphics. texi2dvi requires a full path specification in order to build the pdf. If tex is given as "file.tex", the working directory will need to be pasted to it to create, for example, "C:/..../file.tex". Sadly, I haven't figured out a way to automate this decision in a platform independent manner. For now, the user will need to make this explicit.) Depending on the working directory (for Windows users), the user may encounter the error "texi2dvi.exe: Windows API error 5: Access is denied." when trying to build documents. This happens when the working directory is write protected. It is advisable to change the working directory to something not write protected. This can be done permanently by right clicking on the R shortcut icon, selecting properties, and changing the directory in the "Start in:" box. When there is a problem with the LaTeX code, the document will not build properly. When this happens, several lines may appear in the R Console that give a nearly unintelligible explanation for the error. I highly recommend first checking that you've included lazy.file.close() at the end of your document. This is easily my most frequent error. In cases where the R Console prints something like what is given below (sometimes the output will be very, very long). The primary piece of information here is that there was an error on lines 72 and 73. By opening the .tex file, you can determine what lazyWeave function generated the problematic code. Look at the top of the block for those lines and the function call is given as a comment in the LaTeX code. SampleFile.tex:72: [perhaps some text, perhaps not] SampleFile.tex:73: One common problem with lazy.table is using a cwidth argument that has a length not equal to the number of columns in the table.