SweaveMiktex: Simple function to run MikTeX

Description Usage Arguments Details Value Examples

View source: R/patchDVI.R

Description

This is a simple script to run Sweave, then MikTeX, then patchDVI.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
SweaveMiktex(Rnw, main = outputname, 
    cmd = "texify",
    options = "--tex-option=-src-specials --tex-option=-interaction=nonstopmode",
    includedir = "--tex-option=--include-directory=",
    stylepath = FALSE, 
    source.code = NULL, 
    make = 1, 
    preview = 'yap "%s"', 
    patchLog=TRUE,
    sleep = 0, ...)
		  
SweavePDFMiktex(Rnw, main = outputname,  
    cmd = "texify --pdf", 
    options = "--tex-option=-synctex=-1 --tex-option=-interaction=nonstopmode",
    includedir = "--tex-option=-include-directory=",
    stylepath = FALSE, 
    source.code = NULL, 
    make = 1, 
    preview = NULL, 
    patchLog = TRUE, 
    sleep = 0, ...)
		  
SweaveDVI(Rnw, main=outputname, 
    texinputs = NULL, 
    source.code = NULL, 
    make = 1, 
    links = NULL,
    preview = NULL, 
    patchLog = TRUE, ...)

SweavePDF(Rnw, main=outputname, 
    texinputs = NULL, 
    source.code = NULL, 
    make = 1, 
    links = NULL,
    preview = NULL, 
    patchLog = TRUE, ...)
	  
SweaveDVIPDFM(Rnw, main = outputname, 
    latex = "latex", latexOpts = "-synctex=1 -interaction=nonstopmode", 
    dvipdfm = "dvipdfm", dvipdfmOpts = "", 
    texinputs = NULL, 
    source.code = NULL, 
    make = 1, 
    preview = NULL, 
    patchLog = TRUE, ...)

Arguments

Rnw

The .Rnw input file

main

The .tex file on which to run latex, defaulting to the output file from Sweave

cmd

The LaTeX command to run

options

Options to pass to LaTeX

includedir

The prefix for an option to give the location of Sweave.sty

stylepath

stylepath argument to pass to Sweave

source.code

If not NULL, a filename to source before running Sweave

make

Value to pass to SweaveAll to control which Sweave files are processed

preview

Command to use to preview result, or NULL for no preview

patchLog

Whether to attempt to patch the console log and ‘.log’ file

sleep

Number of seconds to sleep if an error is detected in the run

texinputs

Extra paths to pass to texi2dvi

links

If not NULL, an option to turn on production of source links via Synctex or source specials

latex,latexOpts

The function to call to convert the ‘.tex’ to ‘.dvi’, and options to put on the command line.

dvipdfm, dvipdfmOpts

The function to call to convert the ‘.dvi’ to ‘.pdf’, and options to put on the command line.

...

Additional options to pass to SweaveAll

Details

If the Rnw argument is a filename ending in ‘.tex’, then weaving is skipped, but the ‘.dvi’ file is still patched (because one of the other files in the project might have come from Sweave).

The source.code argument may be used to temporarily install code before running the document through the weaver (e.g. Sweave). It could install an experimental version of Sweave, or set up some variables to be used by other code chunks, etc. (Note that things are sourced locally, whereas Sweave runs things in the global environment, so the file will need to make explicit assignments there, and it should avoid using names that clash with the argument names to SweaveMiktex or SweavePDFMiktex.)

The functions invoke Latex differently. SweaveMiktex is designed to call Miktex's texify command to produce a ‘.dvi’ file. SweavePDFMiktex does the same, but produces a ‘.pdf’. SweaveDVI and SweavePDF are similar, but use a modified version of R's texi2dvi function to invoke Latex. SweaveDVIPDFM does the conversion to ‘.pdf’ in two stages.

The patchLog option makes use of the new patchLog function.

Value

These functions are run for the side effects.

Examples

1
2
3
4
## Not run: 
SweaveMiktex("chapter.Rnw", "book.tex")

## End(Not run)

patchDVI documentation built on March 14, 2020, 3:01 a.m.