Sweave
that translates R code chunks in
LaTeX files.RweaveLatex()RweaveLatexSetup(file, syntax, output = NULL, quiet = FALSE,
debug = FALSE, stylepath, ...)
Sweave
.SweaveSyntax
.file
are also removed such that the output is
created in the current working directory.TRUE
all progress messages are suppressed.TRUE
, input and output of all code
chunks is copied to the console.grdevice
is supplied for a code chunk with both
fig
and eval
true, the following call is made
get(options$grdevice, envir = .GlobalEnv)(name=, width=,
height=, options)
which should open a graphics device. The chunk's code is then
evaluated and dev.off
is called. Normally a function of
the name given will have been defined earlier in the Sweave document, e.g.
< A replacement for dev.off
can be provided as a function
with suffix .off
, e.g.my.Swd.off()
.
getOption("SweaveHooks")
is set, it is taken
to be a named list of hook functions. For each logical option of a
code chunk (echo
, print
, ...) a hook can be
specified, which is executed if and only if the respective option is
TRUE
. Hooks must be named elements of the list returned by
getOption("SweaveHooks")
and be functions taking no arguments.
E.g., if option "SweaveHooks"
is defined as list(fig =
foo)
, and foo
is a function, then it would be executed before
the code in each figure chunk. This is especially useful to set
defaults for the graphical parameters in a series of figure chunks. Note that the user is free to define new Sweave logical options and
associate arbitrary hooks with them. E.g., one could define a hook
function for a new option called clean
that removes all objects
in the workspace. Then all code chunks specified with clean =
TRUE
would start operating on an empty workspace.
RweaveLatex
driver. If stylepath = TRUE
, a hard-coded
path to the file Sweave
. The hard-coded path makes the LaTeX file less
portable, but avoids the problem of installing the current version of
The default for stylepath
is now taken from the environment
variable FALSE
it that is
unset or empty. If set, it should be exactly TRUE
or
FALSE
: any other values are taken as FALSE
.
The simplest way for frequent Sweave users to ensure that
By default,
This setting affects the width size option passed to the \includegraphics{} directive for each plot file and in turn impacts the scaling of your plot files as they will appear in your final document.
Thus, for example, you may set width=3
in your figure chunk and
the generated graphics files will be set to 3 inches in
width. However, the width of your graphic in your final document will
be set to 0.8\textwidth and the height dimension will be
scaled accordingly. Fonts and symbols will be similarly scaled in the
final document.
You can adjust the default value by including the
\setkeys{Gin}{width=...} directive in your width
option value as you prefer, using standard LaTeX
measurement values.
If you wish to override this default behavior entirely, you can add a
\usepackage[nogin]{Sweave} directive in your preamble. In this
case, no size/scaling options will be passed to the
\includegraphics{} directive and the height
and
width
options will determine both the runtime generated graphic
file sizes and the size of the graphics in your final document.
As from R3.1.0 it also supports the [inconsolata] option, to
render monospaced text in inconsolata
, the font used by default
for Rhelp pages.
The use of fancy quotes (see sQuote
) can cause problems
when setting Routput. Either set
options(useFancyQuotes = FALSE)
or arrange that LaTeX is
aware of the encoding used (by a \usepackage[utf8]{inputenc}
declaration: Windows users of Sweave
from
Some LaTeX graphics drivers do not include .png or .jpg
in the list of known extensions. To enable them, add something like
\DeclareGraphicsExtensions{.png,.pdf,.jpg} to the preamble of
your document or check the behavior of your graphics driver. When
both pdf
and png
are TRUE
both files will be
produced by Sweave
, and their order in the
DeclareGraphicsExtensions list determines which will be used by