Skip to content

CHANGES IN knitr VERSION 0.8

Compare
Choose a tag to compare
@yihui yihui released this 25 May 21:31
· 4599 commits to master since this release

NEW FEATURES

  • output from other languages (e.g. python, awk, ...) can also be cached like R output when cache=TRUE; see 023-engine-python.Rmd for an example
  • added support for bash/shell scripts; use the chunk option engine='bash' or engine='sh' to write shell scripts in code chunks (#361)
  • a new function knit_rd() to knit package documentation (run examples code and insert output in the HTML documentation) (#227) (thanks, Taiyun Wei)
  • added LuaTeX support for tikz graphics with the tikzDevice package (set options(tikzDefaultEngine = 'luatex')); this feature requires tikzDevice version > 0.6.2 (#358) (thanks, Alastair Andrew)
  • a new chunk option fig.env to set which environment to use for figures in LaTeX, e.g. we can set fig.env='marginfigure' to use \begin{marginfigure} (#364) (thanks, Bryan Hanson)
  • added a new package option global.device (default FALSE) which specifies whether to use a global graphics device to capture plots; if TRUE, it is possible to write plot(1:10) in a previous chunk and abline(0, 1) in a latter chunk because all code chunks share the same device, however, this may also bring unexpected consequences (in particular, using par() can bring redundant plots)

BUG FIXES

  • dots in figure paths are more safely replaced with _ now, e.g. fig.path='../figure' will no longer be replaced by __/figure (#346) (thanks, @Ralfer)
  • the c() syntax for the chunk option dependson did not actually work, e.g. dependson=c('foo', 'bar') (#350) (thanks, Cassio Pereira)
  • fixed a bug when eval=FALSE and prompt=TRUE (the continuation character was used in some places where there should be the prompt character) (thanks, Derek Ogle)
  • persp() plots were not recognized in the last version (thanks, Jeffrey Racine)

MAJOR CHANGES

  • leading spaces are allowed in chunk headers now, e.g. in the past <<>>= must appear in the beginning of a line, but now we can indent the chunk header by a number of white spaces; this amount of spaces will be stripped off the chunk if the whole chunk is indented (#236) (thanks, @jamiefolson and Vitalie Spinu)
  • markdown output will be indented if the original code chunk is indented; this allows chunk output to be nested within its parent environment, e.g. inside an ordered list (see 001-minimal.Rmd for example)
  • when the global chunk option eval=FALSE, inline R code will not be evaluated, and ?? is returned for inline R expressions (#367)

MINOR CHANGES

  • if getOption('OutDec') is not ., inline numeric output will be put inside \text{} in LaTeX to avoid situations like #348 (the normal math mode may add a space after the comma in 3,1415)
  • if the chunk option external==FALSE (default is TRUE), knitr will no longer automatically add \usepackage{tikz} to the LaTeX preamble; you need to add it manually (but it is recommended to use external=TRUE with cache=TRUE for the sake of speed, because compilation of tikz graphics may be slow)
  • *.brew generates *.txt by default (instead of *-out.brew)
  • knit(text = ...) will no longer write output in the console (the output is only returned as a character string)

DOCUMENTATION