From 11ddfc6edbdffa1ad4e161f1cfacc75dd6aaa89d Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Wed, 18 Sep 2019 07:33:50 -0500 Subject: [PATCH] remove the option `width` from opts_knit, and don't change options(width) in knit() (i.e. respect user's width option) --- DESCRIPTION | 2 +- NEWS.md | 6 ++++++ R/defaults.R | 4 ++-- R/output.R | 5 ++--- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a6cc476448..dd25ab5816 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: knitr Type: Package Title: A General-Purpose Package for Dynamic Report Generation in R -Version: 1.25 +Version: 1.25.1 Authors@R: c( person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), person("Adam", "Vogt", role = "ctb"), diff --git a/NEWS.md b/NEWS.md index 5ad689eb8c..fc5e18e8e3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# CHANGES IN knitr VERSION 1.26 + +## MINOR CHANGES + +- `knit()` no longer adjusts the global R option `width`; previously it sets `options(width = 75)` by default. + # CHANGES IN knitr VERSION 1.25 ## NEW FEATURES diff --git a/R/defaults.R b/R/defaults.R index c8a5eb33db..fd37df1433 100644 --- a/R/defaults.R +++ b/R/defaults.R @@ -158,7 +158,7 @@ set_alias = function(...) { #' } #' @include hooks-html.R opts_knit = new_defaults(list( - progress = TRUE, verbose = FALSE, width = 75L, eval.after = 'fig.cap', + progress = TRUE, verbose = FALSE, eval.after = 'fig.cap', base.dir = NULL, base.url = NULL, root.dir = NULL, child.path = '', upload.fun = identity, global.device = FALSE, global.par = FALSE, concordance = FALSE, documentation = 1L, self.contained = TRUE, @@ -173,7 +173,7 @@ opts_knit = new_defaults(list( # you may modify these options in options(knitr.package.foo) opts_knit_names = c( - 'progress', 'verbose', 'width', 'upload.fun', 'animation.fun', 'global.device', + 'progress', 'verbose', 'upload.fun', 'animation.fun', 'global.device', 'eval.after', 'concordance', 'documentation', 'aliases', 'self.contained', 'unnamed.chunk.label' ) diff --git a/R/output.R b/R/output.R index 6b0c949a96..65b3376c7b 100644 --- a/R/output.R +++ b/R/output.R @@ -145,10 +145,9 @@ knit = function( knit_log$restore() on.exit(chunk_counter(reset = TRUE), add = TRUE) # restore counter adjust_opts_knit() - # turn off fancy quotes, use smaller width + # turn off fancy quotes, use a null pdf device to record graphics oopts = options( - useFancyQuotes = FALSE, width = opts_knit$get('width'), - knitr.in.progress = TRUE, device = pdf_null + useFancyQuotes = FALSE, device = pdf_null, knitr.in.progress = TRUE ) on.exit(options(oopts), add = TRUE) # restore chunk options after parent exits