Skip to content

Commit

Permalink
use an unevaluated expression as chunk option to set width (very hack…
Browse files Browse the repository at this point in the history
…ish)
  • Loading branch information
yihui committed Nov 8, 2012
1 parent e212070 commit 8c63c40
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions _bin/knit
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ library(knitr)
stopifnot('_source' %in% list.files()) # run me from the root directory
render_jekyll()

opts_chunk$set(r.width = TRUE, pars = list(mar = c(4, 4, .1, .1), mgp = c(2, 1, 0), bg = 'white'))
knit_hooks$set(r.width = function(before, options, envir) {
if (before) options(width = 60) else opts_chunk$set(r.width = NULL)
}, pars = function(before, options, envir) {
opts_chunk$set(r.width = quote(options(width = 65)),
pars = list(mar = c(4, 4, .1, .1), mgp = c(2, 1, 0), bg = 'white'))
knit_hooks$set(pars = function(before, options, envir) {
if (before) do.call(par, options$pars)
}, rgl = hook_rgl, crop = hook_pdfcrop)

Expand Down

0 comments on commit 8c63c40

Please sign in to comment.