Releases: yihui/knitr
knitr 1.39
MAJOR CHANGES
- Added an argument
rel_path
toinclude_graphics()
, which defaults toTRUE
, meaning that this function will try to convert absolute paths to relative paths automatically. If the conversion fails, it will issue a warning. If you want to suppress the conversion (and the warning), you may userel_path = FALSE
or set the global optionoptions(knitr.graphics.rel_path = FALSE)
. In the previous version of knitr, this function would always issue a warning when it detects absolute paths (thanks, @davidski @kendavidn, #2119).
MINOR CHANGES
-
For knitr source documents that generate
.tex
output documents (such as.Rnw
and.Rtex
), the LaTeX package xcolor will be used instead of color (#2085). This may cause option clashes if xcolor is already loaded by users with options, e.g.,\usepackage[dvipsnames]{xcolor}
. If this happens, you may set the package optionknitr::opts_knit$set(latex.options.xcolor = 'OPTIONS')
whereOPTIONS
is the options you used for xcolor, e.g.,dvipsnames
. -
The evaluation of chunk options written after
#|
using the YAML!expr
syntax will be delayed until before the chunk is to be evaluated (#2120).
knitr 1.38
NEW FEATURES
-
The chunk option
file
can take a vector of file paths now, i.e., this option can be used to read more than one file (e.g.,file = c("foo.R", "bar.R")
. -
Added a new engine named
exec
(#2073) to execute an arbitrary command on the code chunk, e.g.,```{exec, command='Rscript'} 1 + 1 ```
The above code chunk executes the
Rscript
command with the chunk body as its input (which basically means executing the R code in a new R session). See the example #124 in the repo https://github.com/yihui/knitr-examples for more info.There exists several command-based engines in knitr, such as
awk
,bash
,perl
,go
, anddot
, etc. This newexec
engine provides a general mechanism to execute any command that users provide. For example, the code chunk```{bash} echo 'Hello world!' ```
is equivalent to the chunk using the
exec
engine and thebash
command:```{exec, command='bash'} echo 'Hello world!' ```
With this new engine, we no longer need to provide or maintain other simple command-based engines. For example, to support TypeScript (#1833), we only need to specify
command = 'ts-node'
with theexec
engine.If the command has significant side-effects (e.g., compile source code to an executable and run the executable, or generate plots to be included in the output), it is also possible to create a new engine based on the
exec
engine. The example #124 in theknitr-examples
repo has provided agcc
example.We'd like to thank @TianyiShi2001 for the inspiration (#1829 #1823 #1833).
-
Added a new engine
ditaa
based on theexec
engine to convert ASCII art diagrams to bitmaps via theditaa
command (thanks, @kondziu, #2092). -
Added two new chunk options,
class.chunk
andattr.chunk
, for R Markdown output. These options can enclose the whole chunk output (source and results) in a fenced Div. Their syntax follows other chunk options with the similar namesclass.*
andattr.*
(e.g.,class.source
andattr.source
). For example,class.chunk = "foo"
would wrap the chunk output inside::: {.foo}
and:::
(thanks, @atusy, #2099). -
Added a new chunk option
lang
to set the language name of a code chunk. By default, the language name is the engine name. This is primarily useful for syntax highlighting the source chunks in Markdown-based output. Previously thelang
option was only available to a few engines such asverbatim
andembed
. Now it is available to all engines. -
Added a new wrapper function
rnw2pdf()
. It allows users to specify an arbitrary output file path, clean the intermediate files, and stop when any error occurs in knitting (thanks, @shrektan, #2113). -
New
calling.handlers
option foropts_chunk$set()
to register calling handlers within chunks. See?evaluate::new_output_handler
for details.
MAJOR CHANGES
-
The minimal required version of R was bumped from 3.2.3 to 3.3.0 (thanks, @essemenoff, #2100).
-
The working directory under which chunk options are evaluated has been changed to the directory of the source document by default. If the package option
root.dir
is set to a different directory, that directory will be used as the working directory (#2081). -
include_graphics()
will expand~
in the image paths now and also warn against absolute paths (thanks, @kcarnold, #2063). -
opts_chunk$set()
returns values of old chunk options after setting new chunk options now, instead of returningNULL
, which can make it a little simpler to reset chunk options, e.g., you can temporarily change a few chunk options and save them withold = opts_chunk$set(error = FALSE, fig.height = 3)
, and reset them later withopts_chunk$set(old)
. This works for any other objects in knitr that have the$set()
methods, such asopts_knit
,opts_hooks
,knit_hooks
,knit_engines
, and so on.
MINOR CHANGES
BUG FIXES
-
Chunk options defined in the
#|
style are not recognized when the code chunk is indented or quoted (thanks, @mine-cetinkaya-rundel, #2086).
knitr 1.37
NEW FEATURES
-
Added a new chunk option named
file
so that the chunk content can be read from an external file. Setting the chunk optionfile = "test.R"
is equivalent to using the chunk optioncode = xfun::read_utf8("test.R")
. -
For R Markdown documents, code chunks can be embedded in a parent code chunk with more backticks now. For example, a code chunk with four backticks can contain code chunks with three backticks. One application is to conditionally include some verbatim content that contains code chunks via the
asis
engine, e.g.,````{asis, echo=format(Sys.Date(), "%w") == 1} Some conditional content only included when report is built on a Monday ```{r} 1 + 1 ``` On another day, this content won't be included. ````
Note that the embedded child code chunks (e.g., in the
asis
chunk above) are not parsed or evaluated by knitr, and only the top-level code chunk is parsed and evaluated. -
Added a new engine named
comment
to comment out content, e.g.,````{comment} Arbitrary content to be commented out. ```{r} 1 + 1 ``` The above code chunk will not be executed. Inline code like `r pi * 5^2` will be ignored, too. ````
Note that if any line of the content to be commented out contains
N
backticks, you will have to use at leastN + 1
backticks in the chunk header and footer of thecomment
chunk. -
Added a new engine named
verbatim
mainly for R Markdown documents to output verbatim content that contains code chunks and/or inline expressions, e.g.,````{verbatim} We can output arbitrary content verbatim. ```{r} 1 + 1 ``` The content can contain inline code like `r pi * 5^2`, too. ````
By default, the verbatim content is placed in a fenced
default
code block:````default We can output arbitrary content verbatim. ```{r} 1 + 1 ``` The content can contain inline code like `r pi * 5^2`, too. ````
You can change the
default
language name of the block via the chunk optionlang
, e.g.,lang = 'markdown'
will output a code block like this:````markdown We can output arbitrary content verbatim. ```{r} 1 + 1 ``` The content can contain inline code like `r pi * 5^2`, too. ````
To disable the language name on the block, use an empty string
lang = ''
.The difference between the
verbatim
andasis
engine is that the former will put the content in a fenced code block, and the latter just output the content as-is.You can also display a file verbatim by using the chunk option
file
, e.g.,```{verbatim, file="test.Rmd"} ```
This engine also works for other types of documents (e.g.,
Rnw
) but it will not allow for nested code chunks within theverbatim
code chunk. -
Added a new engine named
embed
to embed external plain-text files. It is essentially a simple wrapper based on theverbatim
engine, with the chunk content read from an external file and default language guessed from file extension. That is,```{embed, file="foo.R"} ```
is equivalent to
```{verbatim, file="foo.R", lang="r"} ```
If you provide the chunk option
file
to theembed
engine, it will read the file and show its content verbatim in the output document. Alternatively, you can specify the file path in the chunk body, e.g.,```{embed} "foo.txt" ```
The quotes are optional but can be helpful for editors (e.g., RStudio IDE) to autocomplete the file paths.
The syntax highlighting language name is from the filename extension by default, and you can override it with the chunk option
lang
(e.g.,file = "foo.sh", lang = "bash"
) which is then identical to theverbatim
engine.
BUG FIXES
-
The chunk option
child
also respects the package optionroot.dir
now (thanks, @salim-b, https://community.rstudio.com/t/117563). -
Fixed a LaTeX error
"Package xcolor Error: Undefined color `fgcolor'"
with.Rnw
documents (thanks, Kurt Hornik).
MINOR CHANGES
- Improved the (warning) message when unbalanced chunk delimiters are detected in R Markdown documents, to make it easier for users to fix the problem. The message now contains the line numbers of the opening fence and closing fence, as well as the opening and closing backticks. For example, the opening fence may be
"````{r}"
(four backticks) but the closing fence is"```"
(three backticks---should also be four to match the opening fence), or the opening fence is indented" ```{r}"
but the closing fence is not"```"
. Note that this warning message may become an error in the future, i.e., unbalanced chunk delimiters will no longer be allowed.
knitr 1.36
MAJOR CHANGES
- In knitr 1.35, if the indentation of the closing backticks does not match the indentation of the chunk header in an Rmd document, the closing backticks would not be treated as closing fence of a code chunk. This behavior has been reverted because we have discovered several cases in which the indentation was accidental. A warning message will be issued instead, and you are still recommended to fix the improper indentation if discovered.
BUG FIXES
- Fixed a regression in knitr 1.31 that caused package vignettes to generate (tangle) invalid R scripts (thanks, @t-kalinowski @halldc, #2052).
knitr 1.35
NEW FEATURES
-
Chunk options can also be written inside a code chunk now after the special comment
#|
, e.g.,```{r} #| echo = FALSE, fig.width = 10, #| fig.cap = "This is a long caption." plot(cars) ```
The main differences between this new syntax and traditional syntax (i.e., chunk options in the chunk header) are: 1) the chunk options can be freely wrapped, i.e., you can write them on as many lines as you prefer; 2) you can also use the YAML syntax instead of the comma-separated syntax if you like, e.g.,
```{r} #| echo: false #| fig.width: 10 ```
Chunk options provided inside a code chunk will override options with the same names in the chunk header if chunk options are provided in both places, e.g.,
```{r, echo = TRUE} #| echo = FALSE, fig.width = 10 ```
The effective chunk options for the above chunk are
echo = FALSE
andfig.width = 10
.
MAJOR CHANGES
-
For R Markdown documents, if the chunk header is indented, the closing backticks (usually
```
) of the chunk must be indented with the same amount of spaces (thanks, @atusy, #2047). For example, the following is no longer a valid code chunk because the chunk header is indented but the closing backticks are not:```{r} 1 + 1 ```
If you see an error "attempt to use zero-length variable name" when knitting an Rmd document, it may be because of this change, and you may have indented the chunk header by accident. If that is the case, you need to remove the extra white spaces before the chunk header.
The same problem applies to blockquotes, i.e.,
>
before```
. If you quote the chunk header, you have to quote the footer as well, e.g.,> ```{r} 1 + 1 ```
The above unbalanced code chunk needs to be corrected to:
> ```{r} > 1 + 1 > ```
Quoting the chunk body is optional but recommended.
BUG FIXES
-
Fixed a regression in v1.34: now blank lines in code chunks are stripped only when
collapse = FALSE
but no longer stripped by default whencollapse = TRUE
. If you prefer blank lines to be always stripped, setstrip.white = TRUE
globally or on the per chunk basis (thanks, @IndrajeetPatil, rstudio/rmarkdown#2220, #2046). -
In
knitr::combine_words()
, whenwords
is length 2 andand = ""
,sep
will now be used (thanks, @eitsupi, #2044). -
For R Markdown documents, if the chunk output contains N backticks, the
output
hook will use N + 1 backticks to wrap the output, so that the N verbatim backticks can be correctly preserved (thanks, @atusy, #2047).
knitr 1.34
NEW FEATURES
-
Added a package option
latex.tilde
so that users can customize the tilde symbol, e.g., you can setknitr::opts_knit$set(latex.tilde = "\\hlopt{\\scriptsize{\\ensuremath{\\sim}}}")
. This is because the default tilde is too high in the PDF output, and it's often more desirable to use a middle tilde instead (thanks, @brry #1992, @jaredlander #492). -
For the
tikz
engine, the class options of thestandalone
document classs can be specified via the chunk optionengine.opts$classoption
(thanks, @XiangyunHuang, #1985). The default value istikz
, i.e.,\documentclass[tikz]{standalone}
is used by default. -
Added the ability to pass additional arguments to
dvisvgm
when using thetikz
engine withfig.ext = "svg"
by usingdvisvgm.opts
inengine.opts
(thanks, @andrewheiss, #2039). Recent versions ofdvisvgm
now allow you to embed fonts into SVG files as base64-encoded WOFF files, sotikz
chunks can embed fonts using like so:```{tikz, fig.ext="svg", engine.opts=list(dvisvgm.opts = "--font-format=woff")}
. -
Added a new
targets
engine (ropensci/targets#503, @wlandau). Details: https://books.ropensci.org/targets/markdown.html. -
The chunk option
cache.globals
can take valuesTRUE
andFALSE
now (in addition to a character vector). WhenFALSE
, it tries to find all symbols in the code chunk, no matter if they are local or global variables. WhenNULL
orTRUE
, it tries to find all global variables (thanks, @knokknok, #1898).
MAJOR CHANGES
-
An error is now thrown when an inline code result is not coercible to character. This has always been the assumed behavior but it happens to be different in certain formats with unknown automatic coercion. This is now enforced to prevent any unexpected output. An inline code expression must evaluate to a character vector or an object coercible by
as.character()
(#2006). -
The markdown package has been moved from
Imports
toSuggests
in knitr'sDESCRIPTION
, which means it is no longer a hard dependency but has become a soft dependency of knitr (#1864). One consequence for package developers is that if you use the vignette engines based on markdown (such asknitr::knitr
), you will have to explicitly declare the (soft) dependency on markdown, because the implicit dependency through knitr is no longer there. -
For R packages that use the
knitr::rmarkdown
engine to build their vignettes,rmarkdown
must be declared as a dependency in the packageDESCRIPTION
(e.g., inSuggests
). Previously, knitr would fall back to using the markdown package to build vignettes if rmarkdown is not declared (#1864, #2020). -
write_bib()
only uses the first URL if multiple are found in a package (#2028).
MINOR CHANGES
-
The attribute
data-external="1"
will be added to<iframe>
s generated byinclude_url()
to prevent Pandoc from embedding the URL as base64 data (thanks, @IndrajeetPatil, https://stackoverflow.com/q/67477667/559676). -
The chunk option
strip.white = TRUE
used to work only when the chunk optioncollapse = FALSE
. Now the two options are independent, i.e.,strip.white
also works whencollapse = TRUE
(thanks, @kbvernon, #2011). -
When building R Markdown vignettes but Pandoc is not available, the vignette engine will emit a message instead of a warning before falling back to using the markdown package.
-
The internal function
is_abs_path()
has been removed. Users (if any) should use the exported functionxfun::is_abs_path()
instead.
BUG FIXES
-
Fix an issue with the RStudio IDE when using
knitr::include_url()
orknitr::include_app()
in interactive Notebook mode. This will no more cause an error but print the list object as is (thanks, @systemnova, #2015). -
Fix a regression with
fig.keep
chunk option used in chunks with only one figure where the figure was not showing in output (thanks, @fmichonneau, #1993). -
Allow vignettes to be tangled (and output compared) in
R CMD check
if they have a corresponding.Rout.save
(thanks, @lentinj, #2018).
knitr 1.33
NEW FEATURES
-
Exported the internal functions
sew()
(previously namedwrap()
) andis_low_change()
to make it possible for other graphics systems such as rgl to work in knitr like base and grid graphics in base R (thanks, @dmurdoch, #1892 #1853). -
For
sql
code chunks, parameterized queries will be executed through native database api if the chunk optionparams
is provided (thanks, @byapparov, #1987).
BUG FIXES
- Reverted the fix for #1595 since it caused problems in kableExtra (thanks, @bttomio, haozhu233/kableExtra#607), and applied a different fix to the original problem (i.e., add
{}
before[
).
MAJOR CHANGES
- The internal S3 generic function
wrap()
has been renamed tosew()
.
MINOR CHANGES
-
For package vignettes that use the vignette engine
knitr::docco_linear
orknitr::docco_classic
, knitr will signal an error duringR CMD build
if the markdown package is not declared as a soft dependency in theSuggests
field inDESCRIPTION
. The same treatment has been applied in the previous version of knitr for the vignette engineknitr::knitr
(#1864). -
R CMD build
will signal an error when a package uses R Markdown vignettes to be build with the rmarkdown package but the rmarkdown package is not installed (thanks, @nsheff, #1864). -
The
force_v1
argument ofknit2html()
defaults togetOption('knitr.knit2html.force_v1', FALSE)
now, which means its value can be configured via a global option.
knitr 1.32
NEW FEATURES
-
The chunk option
ref.label
can be used to reuse code from other code chunks in the current code chunk. Now it can also accept a character vector of chunk labels wrapped inI()
so that the chunk options of other code chunks can also be applied to the current chunk. For example, if we have a chunk```{r, chunk-a, echo=FALSE, results='asis'}
, the chunk```{r, chunk-b, ref.label=I('chunk-a')}
will inherit both the code and chunk options fromchunk-a
(e.g.,echo=FALSE
andresults='asis'
), butchunk-b
can still override these chunk options, e.g., the actual chunk options of```{r, chunk-b, echo=TRUE}
will beecho=TRUE
andresults='asis'
. If you want to use one code chunk with several chunk options for multiple times, and each time you want to change a small subset of the chunk options, you may use this approachref.label = I()
to avoid typing most chunk options over and over again (thanks, @atusy, #1960). -
The chunk option
opts.label
gained a new usage. It used to mean labels inknitr::opts_template
(see the help page if you are not familiar with this object). Now it can also be used to specify the labels of other code chunks, from which the chunk options are to be inherited to the current chunk. For example,```{r, chunk-b, opts.label='chunk-a'}
means thatchunk-b
will inherit chunk options fromchunk-a
. Local chunk options in a chunk (if exist) will override inherited options. For the new features about both chunk optionsref.label
andopts.label
, see the detailed documentation and examples at https://yihui.org/knitr/options/ (thanks, @atusy, #1960). -
The internal code to process R code chunks was factored out into the language engine
R
, which can be obtained viaknit_engines$get('R')
now (thanks, @abhsarma, #1963). -
Added arguments
dir
andenvir
toload_cache()
to specify the working directory and environment into which the cached objects are loaded. By default, all cached objects are loaded into the global environment, which may not be desirable (thanks, @LTLA, #1905). -
The internal function
html_screenshot()
, which takes screenshots of HTML widgets and Shiny apps in knitr documents, now prefers the webshot2 package over the webshot package. This is because the backend of the webshot package is PhantomJS, which has been archived since 2018. If webshot is still preferred, use the chunk optionopts_chunk$set(webshot = "webshot")
(thanks, @atusy #1918, @LouisStAmour #1858). -
Added a new engine,
bslib
, which is a specialscss
/sass
engine for writing Sass code that wants to leverage Bootstrap Sass. It's primarily designed to work withrmarkdown::html_document_base
'stheme
parameter (when it represents abslib::bs_theme()
), but the engine can be used anywhere abslib::bs_theme()
is set globally withbslib::bs_global_set()
(thanks, @cpsievert, #1666). -
When the chunk option
include = FALSE
,error = TRUE
used to be ignored, i.e., errors are signaled nonetheless (causing the knitting process to fail). To avoid this problem, you can now use the numeric valueerror = 0
so that knitr will not check theinclude
option, i.e., knitting will not fail even ifinclude = FALSE
and an error has occurred in a code chunk, which you wouldn't notice (thanks, @rundel, #1914). -
When processing package vignettes that require rmarkdown or markdown, we now check that it is declared as a package dependency in the
DESCRIPTION
file (thanks, @dmurdoch, #1919). -
For
tikz
code chunks, a new optionengine.opts$extra.preamble
allows arbitrary LaTeX code to be inserted into the preamble of the template. This allows loading of additional LaTeX and tikz libraries without having to recreate a template from scratch (thanks, @krivit, #1886).
BUG FIXES
-
Fixed an issue where code source and results would not show when using a numeric vector in
fig.keep
to select all plots (thanks, @dongzhuoer @ajrgodfrey #1579, @cderv #1955). -
Graphical parameter
par(col =)
is now preserved as expected in following chunks whenknitr::opts_knit$set(global.par = TRUE)
(thanks, @arnonl, @RolandASc, #1603). -
Fixed an issue with
kable(format = "latex", booktabs = TRUE)
when the first cell of the table stats with[
(thanks, @jonnypenarth, #1595). -
For child documents,
include_graphics(error = FALSE)
is the default now (#1957). -
For Rnw documents, the commented
%\begin{document}
will no longer cause trouble (thanks, @NewbieKnitter @shrektan, #1819). -
Fixed an issue with the chunk option
fig.alt
causing figures to disappear inrmarkdown::word_document()
output. This option is currently supported for HTML output only. If provided for office output in rmarkdown, it will emit a warning and be ignored (#1966). -
Spaces in messages were not properly escaped in
.Rnw
documents (thanks, @elbersb, #1978). -
The hook
hook_pdfcrop()
did not crop figures generated by thetikz
ordot
engine (thanks, @giabaio yihui/xaringan#285, @cderv #1923).
MINOR CHANGES
-
For Rnw documents, if a chunk's output ends with
\n
, knitr will no longer add another\n
to it (thanks, @krivit #1958, @jpritikin 1092). -
For
kable(x, format = 'simple')
, it no longer generates apipe
table but asimple
table instead whenx
has only one column (thanks, @alusiani, #1968). Forkable(x, format = 'pipe')
, it no longer warns whenx
has no column names, but just generate an empty table header. -
For
tikz
code chunks, the default LaTeX template uses\documentclass[tikz]{standalone}
instead of\documentclass{article}
and\usepackage{preview}
now (thanks, @XiangyunHuang, #1985).
knitr 1.31
NEW FEATURES
-
Exported the functions
pandoc_to()
andpandoc_from()
to get the output and input Pandoc format respectively when knitting R Markdown documents (thanks, @cderv, #1951). -
Added a new chunk option
fig.alt
for users to specify the alternative text in thealt
attribute of the<img>
tag (images). Previously, thealt
attribute takes value from the chunk optionfig.cap
(it still does so iffig.alt
isNULL
). If there are multiple plots/images in a chunk, you can pass a character vector tofig.alt
, and it will be applied to individual images (thanks, @cderv, #1900). -
include_url()
andinclude_app()
can now take a vector of URLs (thanks, @cderv, #1948). -
The
sql
engine now correctly captures error with the chunk optionerror = TRUE
(thanks, @colearendt, rstudio/rmarkdown#1208). -
The chunk option
collapse = TRUE
now works as expected when the chunk optionattr.*
orclass.*
is provided. By this change, The chunk optioncollapse = TRUE
forcesattr.*
andclass.*
beNULL
except for the chunk optionsattr.source
andclass.source
(thanks, @aosavi @cderv @atusy, #1902 #1906). -
New links added in
?knitr::kable()
help page to the Rmarkdown Cookbook relevant pages. -
The table label can be disabled via
kable(label = NA)
now (thanks, @NickCH-K, #1937). -
The
table.attr
argument inkable(.., format = 'html')
can take the value from the global optionknitr.table.html.attr
now (thanks, @cderv, #1922). -
Added a new argument
oxford_comma
to the functioncombine_words()
(thanks, @thompsonsed, #1946). -
The label prefix of tables generated by
kable()
can be customized via the package optionlabel.prefix
inopts_knit
now. This option takes a named character vector, and the default isknitr::opts_knit$set(label.prefix = c(table = 'tab:'))
. If you want to use a different prefix such astbl
, you may set the option toc(table = 'tbl:')
(thanks, @luispfonseca, #1890). -
The global option
options(knitr.device.fallback = TRUE)
can be used to allow the graphical device specified in the chunk optiondev
to fall back to other usable devices if the specified device is not operational. Users can provide a list of fallback devices via the global option, e.g.,options(knitr.device.choices = list(png = c('jpeg', 'svg'), jpeg = c('tiff')))
, which means thepng
device can fall back tojpeg
andsvg
(the first operational device in the list is used) andjpeg
can fall back totiff
.
BUG FIXES
- Line numbers in error messages are incorrect when the error occurs in a child Rmd document (thanks, @cderv @khughitt, #1945).
MAJOR CHANGES
- Previously
knit_exit()
in a child document would not terminate the knitting process of its parent document. Now it will terminate the whole process by default. You can useknit_exit(fully = FALSE)
to exit the child document only (thanks, @davidchall, #1810).
MINOR CHANGES
- Vignette engines for R Markdown vignettes no longer check for availability of
pandoc-citeproc
since it has gone since Pandoc 2.11.
knitr 1.30
NEW FEATURES
-
Added
knitr::hooks_*()
functions to get a list of output hooks for a specific format. Previously, these hooks only exist inside theknitr::render_*()
functions, and users do not have direct access to them. Now they can be accessed directly, e.g., viaknitr::hooks_markdown()
to get a list of output hooks for R Markdown documents. You can also set the output hooks individually, e.g.,knitr::knit_hooks$set(knitr::hooks_markdown()['source'])
only sets the source ouput hook. See more on output hooks at https://yihui.org/knitr/hooks/#output-hooks and https://bookdown.org/yihui/rmarkdown-cookbook/output-hooks.html (thanks, @cderv, #1889). -
Added an argument
lib.loc
toknitr::write_bib()
.
BUG FIXES
-
The option
fig_caption = FALSE
forrmarkdown::html_document()
was unable to suppress the figure captions in some cases. -
The internal function
fix_options()
should be called after option hooks are executed (thanks, @atusy, #1876 and #1877). -
When the option
options(OutDec = )
is set to a value other than"."
, percentages in the chunk optionsout.width
andout.height
do not work (thanks, @omgitsmoe, #1887).
MINOR CHANGES
-
knitr::write_bib()
removes pairs of single quotes in the titles of citation entries now. -
knitr::write_bib()
uses theURL
in the packageDESCRIPTION
if it is provided, instead of the canonical CRAN URL for the package. -
hook_pdfcrop()
andplot_crop()
will work only when both programspdfcrop
andghostscript
have been installed. Previously onlypdfcrop
was checked (thanks, @dalupus, #954).