| Line 60... |
Line 60... |
| 60 |
|
60 |
|
| 61 |
This setting affects the width size option passed to the
|
61 |
This setting affects the width size option passed to the
|
| 62 |
\samp{\\includegraphics{}} directive for each plot file and in turn
|
62 |
\samp{\\includegraphics{}} directive for each plot file and in turn
|
| 63 |
impacts the scaling of your plot files as they will appear in your
|
63 |
impacts the scaling of your plot files as they will appear in your
|
| 64 |
final document.
|
64 |
final document.
|
| 65 |
|
65 |
|
| 66 |
Thus, for example, you may set \code{width=3} in your figure chunk and
|
66 |
Thus, for example, you may set \code{width=3} in your figure chunk and
|
| 67 |
the generated graphics files will be set to 3 inches in
|
67 |
the generated graphics files will be set to 3 inches in
|
| 68 |
width. However, the width of your graphic in your final document will
|
68 |
width. However, the width of your graphic in your final document will
|
| 69 |
be set to \samp{0.8\\textwidth} and the height dimension will be
|
69 |
be set to \samp{0.8\\textwidth} and the height dimension will be
|
| 70 |
scaled accordingly. Fonts and symbols will be similarly scaled in the
|
70 |
scaled accordingly. Fonts and symbols will be similarly scaled in the
|
| 71 |
final document.
|
71 |
final document.
|
| 72 |
|
72 |
|
| 73 |
You can adjust the default value by including the
|
73 |
You can adjust the default value by including the
|
| 74 |
\samp{\\setkeys{Gin}{width=...}} directive in your \file{.Rnw} file
|
74 |
\samp{\\setkeys{Gin}{width=...}} directive in your \file{.Rnw} file
|
| 75 |
after the \samp{\\begin{document}} directive and changing the
|
75 |
after the \samp{\\begin{document}} directive and changing the
|
| 76 |
\code{width} option value as you prefer, using standard LaTeX
|
76 |
\code{width} option value as you prefer, using standard LaTeX
|
| 77 |
measurement values.
|
77 |
measurement values.
|
| 78 |
|
78 |
|
| 79 |
If you wish to override this default behavior entirely, you can add a
|
79 |
If you wish to override this default behavior entirely, you can add a
|
| 80 |
\samp{\\usepackage[nogin]{Sweave}} directive in your preamble. In this
|
80 |
\samp{\\usepackage[nogin]{Sweave}} directive in your preamble. In this
|
| 81 |
case, no size/scaling options will be passed to the
|
81 |
case, no size/scaling options will be passed to the
|
| 82 |
\samp{\\includegraphics{}} directive and the \code{height} and
|
82 |
\samp{\\includegraphics{}} directive and the \code{height} and
|
| 83 |
\code{width} options will determine both the runtime generated graphic
|
83 |
\code{width} options will determine both the runtime generated graphic
|
| Line 85... |
Line 85... |
| 85 |
|
85 |
|
| 86 |
\file{Sweave.sty} also supports the \samp{[noae]} option, which
|
86 |
\file{Sweave.sty} also supports the \samp{[noae]} option, which
|
| 87 |
suppresses the use of the \samp{ae} package, the use of which may
|
87 |
suppresses the use of the \samp{ae} package, the use of which may
|
| 88 |
interfere with certain encoding and typeface selections. If you have
|
88 |
interfere with certain encoding and typeface selections. If you have
|
| 89 |
problems in the rendering of certain character sets, try this option.
|
89 |
problems in the rendering of certain character sets, try this option.
|
| 90 |
|
90 |
|
| 91 |
The use of fancy quotes (see \code{\link{sQuote}}) can cause problems
|
91 |
The use of fancy quotes (see \code{\link{sQuote}}) can cause problems
|
| 92 |
when setting \R output. Either set
|
92 |
when setting \R output. Either set
|
| 93 |
\code{\link{options}(useFancyQuotes = FALSE)} or arrange that LaTeX is
|
93 |
\code{\link{options}(useFancyQuotes = FALSE)} or arrange that LaTeX is
|
| 94 |
aware of the encoding used (by a \samp{\\usepackage[utf8]\{inputenc\}}
|
94 |
aware of the encoding used (by a \samp{\\usepackage[utf8]\{inputenc\}}
|
| 95 |
declaration: Windows users of \code{Sweave} from \command{Rgui.exe}
|
95 |
declaration: Windows users of \code{Sweave} from \command{Rgui.exe}
|
| 96 |
will need to replace \samp{utf8} by \samp{cp1252} or similar) and
|
96 |
will need to replace \samp{utf8} by \samp{cp1252} or similar) and
|
| 97 |
ensure that typewriter fonts containing directional quotes are used.
|
97 |
ensure that typewriter fonts containing directional quotes are used.
|
| 98 |
|
98 |
|
| 99 |
Some LaTeX graphics drivers do not include \samp{.png} or \samp{.jpg}
|
99 |
Some LaTeX graphics drivers do not include \samp{.png} or \samp{.jpg}
|
| 100 |
in the list of known extensions. To enable them, add something like
|
100 |
in the list of known extensions. To enable them, add something like
|
| 101 |
\samp{\\DeclareGraphicsExtensions{.png,.pdf,.jpg}} to the preamble of
|
101 |
\samp{\\DeclareGraphicsExtensions{.png,.pdf,.jpg}} to the preamble of
|
| 102 |
your document or check the behavior of your graphics driver. When
|
102 |
your document or check the behavior of your graphics driver. When
|
| 103 |
both \code{pdf} and \code{png} are \code{TRUE} both files will be
|
103 |
both \code{pdf} and \code{png} are \code{TRUE} both files will be
|
| Line 109... |
Line 109... |
| 109 |
\section{Supported Options}{
|
109 |
\section{Supported Options}{
|
| 110 |
\code{RweaveLatex} supports the following options for code chunks (the
|
110 |
\code{RweaveLatex} supports the following options for code chunks (the
|
| 111 |
values in parentheses show the default values). Character string
|
111 |
values in parentheses show the default values). Character string
|
| 112 |
values should be quoted when passed from \code{\link{Sweave}} through
|
112 |
values should be quoted when passed from \code{\link{Sweave}} through
|
| 113 |
\code{\dots} but not when use in the header of a code chunk.
|
113 |
\code{\dots} but not when use in the header of a code chunk.
|
| 114 |
\describe{
|
114 |
\describe{
|
| 115 |
\item{engine:}{character string (\code{"R"}). Only chunks with
|
115 |
\item{engine:}{character string (\code{"R"}). Only chunks with
|
| 116 |
\code{engine} equal to \code{"R"} or \code{"S"} are processed.}
|
116 |
\code{engine} equal to \code{"R"} or \code{"S"} are processed.}
|
| 117 |
|
117 |
|
| 118 |
\item{echo:}{logical (\code{TRUE}). Include \R code in the output
|
118 |
\item{echo:}{logical (\code{TRUE}). Include \R code in the output
|
| 119 |
file?}
|
119 |
file?}
|
| 120 |
|
120 |
|
| 121 |
\item{keep.source:}{logical (\code{TRUE}). When echoing, if
|
121 |
\item{keep.source:}{logical (\code{TRUE}). When echoing, if
|
| 122 |
\code{keep.source == TRUE} the original source is copied to the
|
122 |
\code{keep.source == TRUE} the original source is copied to the
|
| 123 |
file. Otherwise, deparsed source is echoed.}
|
123 |
file. Otherwise, deparsed source is echoed.}
|
| 124 |
|
124 |
|
| 125 |
\item{eval:}{logical (\code{TRUE}). If \code{FALSE}, the code chunk
|
125 |
\item{eval:}{logical (\code{TRUE}). If \code{FALSE}, the code chunk
|
| 126 |
is not evaluated, and hence no text nor graphical output
|
126 |
is not evaluated, and hence no text nor graphical output
|
| 127 |
produced.}
|
127 |
produced.}
|
| 128 |
|
128 |
|
| 129 |
\item{results:}{character string (\code{"verbatim"}). If
|
129 |
\item{results:}{character string (\code{"verbatim"}). If
|
| 130 |
\code{"verbatim"}, the output of \R commands is included in the
|
130 |
\code{"verbatim"}, the output of \R commands is included in the
|
| 131 |
verbatim-like \samp{Soutput} environment. If \code{"tex"}, the
|
131 |
verbatim-like \samp{Soutput} environment. If \code{"tex"}, the
|
| 132 |
output is taken to be already proper LaTeX markup and included as
|
132 |
output is taken to be already proper LaTeX markup and included as
|
| 133 |
is. If \code{"hide"} then all output is completely suppressed
|
133 |
is. If \code{"hide"} then all output is completely suppressed
|
| 134 |
(but the code executed during the weave).}
|
134 |
(but the code executed during the weave).}
|
| 135 |
|
135 |
|
| 136 |
\item{print:}{logical (\code{FALSE}). If \code{TRUE}, this forces
|
136 |
\item{print:}{logical (\code{FALSE}). If \code{TRUE}, this forces
|
| 137 |
auto-printing of all expressions.}
|
137 |
auto-printing of all expressions.}
|
| 138 |
|
138 |
|
| 139 |
\item{term:}{logical (\code{TRUE}). If \code{TRUE}, visibility of
|
139 |
\item{term:}{logical (\code{TRUE}). If \code{TRUE}, visibility of
|
| 140 |
values emulates an interactive \R session: values of assignments
|
140 |
values emulates an interactive \R session: values of assignments
|
| 141 |
are not printed, values of single objects are printed. If
|
141 |
are not printed, values of single objects are printed. If
|
| 142 |
\code{FALSE}, output comes only from explicit \code{\link{print}}
|
142 |
\code{FALSE}, output comes only from explicit \code{\link{print}}
|
| 143 |
or similar statements.}
|
143 |
or similar statements.}
|
| 144 |
|
144 |
|
| 145 |
\item{split:}{logical (\code{FALSE}). If \code{TRUE}, text output
|
145 |
\item{split:}{logical (\code{FALSE}). If \code{TRUE}, text output
|
| 146 |
is written to separate files for each code chunk.}
|
146 |
is written to separate files for each code chunk.}
|
| 147 |
|
147 |
|
| 148 |
\item{strip.white:}{character string (\code{"true"}). If
|
148 |
\item{strip.white:}{character string (\code{"true"}). If
|
| 149 |
\code{"true"}, blank lines at the beginning and end of output are
|
149 |
\code{"true"}, blank lines at the beginning and end of output are
|
| 150 |
removed. If \code{"all"}, then all blank lines are removed from
|
150 |
removed. If \code{"all"}, then all blank lines are removed from
|
| 151 |
the output. If \code{"false"} then blank lines are retained.
|
151 |
the output. If \code{"false"} then blank lines are retained.
|
| 152 |
|
152 |
|
| Line 154... |
Line 154... |
| 154 |
whitespace (spaces and tabs).
|
154 |
whitespace (spaces and tabs).
|
| 155 |
|
155 |
|
| 156 |
Note that blank lines in a code chunk will usually produce a
|
156 |
Note that blank lines in a code chunk will usually produce a
|
| 157 |
prompt string rather than a blank line on output.
|
157 |
prompt string rather than a blank line on output.
|
| 158 |
}
|
158 |
}
|
| 159 |
|
159 |
|
| 160 |
\item{prefix:}{logical (\code{TRUE}). If \code{TRUE} generated
|
160 |
\item{prefix:}{logical (\code{TRUE}). If \code{TRUE} generated
|
| 161 |
filenames of figures and output all have the common prefix given
|
161 |
filenames of figures and output all have the common prefix given
|
| 162 |
by the \code{prefix.string} option: otherwise only unlabelled
|
162 |
by the \code{prefix.string} option: otherwise only unlabelled
|
| 163 |
chunks use the prefix.}
|
163 |
chunks use the prefix.}
|
| 164 |
|
164 |
|
| 165 |
\item{prefix.string:}{a character string, default is the name of the
|
165 |
\item{prefix.string:}{a character string, default is the name of the
|
| 166 |
source file (without extension). Note that this is used as part
|
166 |
source file (without extension). Note that this is used as part
|
| 167 |
of filenames, so needs to be portable.}
|
167 |
of filenames, so needs to be portable.}
|
| 168 |
|
168 |
|
| 169 |
\item{include:}{logical (\code{TRUE}), indicating whether input
|
169 |
\item{include:}{logical (\code{TRUE}), indicating whether input
|
| 170 |
statements for text output (if \code{split = TRUE}) and
|
170 |
statements for text output (if \code{split = TRUE}) and
|
| 171 |
\samp{\\includegraphics} statements for figures should be
|
171 |
\samp{\\includegraphics} statements for figures should be
|
| 172 |
auto-generated. Use \code{include = FALSE} if the output should
|
172 |
auto-generated. Use \code{include = FALSE} if the output should
|
| 173 |
appear in a different place than the code chunk (by placing the
|
173 |
appear in a different place than the code chunk (by placing the
|
| 174 |
input line manually).}
|
174 |
input line manually).}
|
| 175 |
|
175 |
|
| 176 |
\item{fig:}{logical (\code{FALSE}), indicating whether the code
|
176 |
\item{fig:}{logical (\code{FALSE}), indicating whether the code
|
| 177 |
chunk produces graphical output. Note that only one figure per
|
177 |
chunk produces graphical output. Note that only one figure per
|
| 178 |
code chunk can be processed this way. The labels for figure
|
178 |
code chunk can be processed this way. The labels for figure
|
| 179 |
chunks are used as part of the file names, so should preferably be
|
179 |
chunks are used as part of the file names, so should preferably be
|
| 180 |
alphanumeric.}
|
180 |
alphanumeric.}
|
| 181 |
|
181 |
|
| 182 |
\item{eps:}{logical (\code{FALSE}), indicating whether EPS figures
|
182 |
\item{eps:}{logical (\code{FALSE}), indicating whether EPS figures
|
| 183 |
should be generated. Ignored if \code{fig = FALSE}.}
|
183 |
should be generated. Ignored if \code{fig = FALSE}.}
|
| 184 |
|
184 |
|
| 185 |
\item{pdf:}{logical (\code{TRUE}), indicating whether PDF figures
|
185 |
\item{pdf:}{logical (\code{TRUE}), indicating whether PDF figures
|
| 186 |
should be generated. Ignored if \code{fig = FALSE}.}
|
186 |
should be generated. Ignored if \code{fig = FALSE}.}
|
| 187 |
|
187 |
|
| 188 |
\item{pdf.version, pdf.encoding, pdf.compress:}{passed to
|
188 |
\item{pdf.version, pdf.encoding, pdf.compress:}{passed to
|
| 189 |
\code{\link{pdf}} to set the version, encoding and compression (or
|
189 |
\code{\link{pdf}} to set the version, encoding and compression (or
|
| 190 |
not). Defaults taken from \code{pdf.options()}.}
|
190 |
not). Defaults taken from \code{pdf.options()}.}
|
| 191 |
|
191 |
|
| 192 |
\item{png:}{logical (\code{FALSE}), indicating whether PNG figures
|
192 |
\item{png:}{logical (\code{FALSE}), indicating whether PNG figures
|
| 193 |
should be generated. Ignored if \code{fig = FALSE}. Only
|
193 |
should be generated. Ignored if \code{fig = FALSE}. Only
|
| 194 |
available in \R >= 2.13.0.}
|
194 |
available in \R >= 2.13.0.}
|
| 195 |
|
195 |
|
| 196 |
\item{jpeg:}{logical (\code{FALSE}), indicating whether JPEG figures
|
196 |
\item{jpeg:}{logical (\code{FALSE}), indicating whether JPEG figures
|
| 197 |
should be generated. Ignored if \code{fig = FALSE}. Only
|
197 |
should be generated. Ignored if \code{fig = FALSE}. Only
|
| 198 |
available in \R >= 2.13.0.}
|
198 |
available in \R >= 2.13.0.}
|
| 199 |
|
199 |
|
| 200 |
\item{grdevice:}{character (\code{NULL}): see section \sQuote{Custom
|
200 |
\item{grdevice:}{character (\code{NULL}): see section \sQuote{Custom
|
| 201 |
Graphics Devices}. Ignored if \code{fig = FALSE}. Only
|
201 |
Graphics Devices}. Ignored if \code{fig = FALSE}. Only
|
| 202 |
available in \R >= 2.13.0.}
|
202 |
available in \R >= 2.13.0.}
|
| 203 |
|
203 |
|
| 204 |
\item{width:}{numeric (6), width of figures in inches. See
|
204 |
\item{width:}{numeric (6), width of figures in inches. See
|
| 205 |
\sQuote{Details}.}
|
205 |
\sQuote{Details}.}
|
| 206 |
|
206 |
|
| 207 |
\item{height:}{numeric (6), height of figures in inches. See
|
207 |
\item{height:}{numeric (6), height of figures in inches. See
|
| 208 |
\sQuote{Details}.}
|
208 |
\sQuote{Details}.}
|
| 209 |
|
209 |
|
| 210 |
\item{resolution:}{numeric (300), resolution in pixels per inch:
|
210 |
\item{resolution:}{numeric (300), resolution in pixels per inch:
|
| 211 |
used for PNG and JPEG graphics. Note that the default is a fairly
|
211 |
used for PNG and JPEG graphics. Note that the default is a fairly
|
| 212 |
high value, appropriate for high-quality plots. Something like
|
212 |
high value, appropriate for high-quality plots. Something like
|
| 213 |
\code{100} is a better choice for package vignettes.}
|
213 |
\code{100} is a better choice for package vignettes.}
|
| 214 |
|
214 |
|
| 215 |
\item{concordance:}{logical (\code{FALSE}). Write a concordance
|
215 |
\item{concordance:}{logical (\code{FALSE}). Write a concordance
|
| 216 |
file to link the input line numbers to the output line numbers.
|
216 |
file to link the input line numbers to the output line numbers.
|
| 217 |
This is an experimental feature; see the source code for the
|
217 |
This is an experimental feature; see the source code for the
|
| 218 |
output format, which is subject to change in future releases.}
|
218 |
output format, which is subject to change in future releases.}
|
| 219 |
|
219 |
|
| 220 |
\item{figs.only:}{logical (\code{FALSE}).
|
220 |
\item{figs.only:}{logical (\code{FALSE}).
|
| 221 |
By default each figure chunk is run once, then re-run for each
|
221 |
By default each figure chunk is run once, then re-run for each
|
| 222 |
selected type of graphics. That will open a default graphics
|
222 |
selected type of graphics. That will open a default graphics
|
| 223 |
device for the first figure chunk and use that device for the first
|
223 |
device for the first figure chunk and use that device for the first
|
| 224 |
evaluation of all subsequent chunks. If this option is true, the
|
224 |
evaluation of all subsequent chunks. If this option is true, the
|