Skip to content

Commit

Permalink
when fig.show='animate' and the output format is LaTeX, use the plot …
Browse files Browse the repository at this point in the history
…hook for LaTeX (i.e. generate \animategraphics{})

thomasp85/gganimate#134 (comment)
  • Loading branch information
yihui committed Oct 8, 2018
1 parent 3d6a6c3 commit 978acd8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: knitr
Type: Package
Title: A General-Purpose Package for Dynamic Report Generation in R
Version: 1.20.15
Version: 1.20.16
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"),
Expand Down
4 changes: 3 additions & 1 deletion R/hooks-md.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ hook_plot_md = function(x, options) {
# if not using R Markdown v2 or output is HTML, just return v1 output
if (is.null(to <- pandoc_to()) || is_html_output(to))
return(hook_plot_md_base(x, options))
if (options$fig.show == 'animate' && is_latex_output())
return(hook_plot_tex(x, options))
office_output = to %in% c('docx', 'pptx', 'rtf', 'odt')
if (!is.null(options$out.width) || !is.null(options$out.height) ||
!is.null(options$out.extra) || options$fig.align != 'default' ||
!is.null(options$fig.subcap)) {
if (to %in% c('beamer', 'latex')) {
if (is_latex_output()) {
# Pandoc < 1.13 does not support \caption[]{} so suppress short caption
if (is.null(options$fig.scap)) options$fig.scap = NA
return(hook_plot_tex(x, options))
Expand Down

0 comments on commit 978acd8

Please sign in to comment.