forked from yihui/knitr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopts_hooks.Rd
35 lines (35 loc) · 1 KB
/
opts_hooks.Rd
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
% Please edit documentation in R/hooks.R
\docType{data}
\name{opts_hooks}
\alias{opts_hooks}
\title{Hooks for code chunk options}
\format{An object of class \code{list} of length 4.}
\usage{
opts_hooks
}
\description{
Like \code{\link{knit_hooks}}, this object can be used to set hook functions
to manipulate chunk options.
}
\details{
For every code chunk, if the chunk option named, say, \code{FOO}, is not
\code{NULL}, and a hook function with the same name has been set via
\code{opts_hooks$set(FOO = function(options) { options })} (you can manipuate
the \code{options} argument in the function and return it), the hook function
will be called to update the chunk options.
}
\examples{
# make sure the figure width is no smaller than fig.height
opts_hooks$set(fig.width = function(options) {
if (options$fig.width < options$fig.height) {
options$fig.width = options$fig.height
}
options
})
# remove all hooks
opts_hooks$restore()
}
\references{
\url{http://yihui.name/knitr/hooks}
}
\keyword{datasets}