在R Markdown演示中设置页面持续时间

时间:2017-04-01 17:37:21

标签: r r-markdown beamer

我需要为闪电话题创建一个自动推进演示文稿。 有没有办法在没有编辑中间.tex文件的情况下在R Markdown中使用Beamer的\hypersetup{pdfpageduration=n}功能?如果可能的话,我希望能够为每张幻灯片设置不同的时间。如果这是一个更容易的替代方案,我可以使用html演示引擎(ioslides或Slidy)。

2 个答案:

答案 0 :(得分:0)

我完全忘了R Sweave! 这是一个功能性的例子,它使用RStudio中的R Sweave格式来解决我的目标。

\documentclass[usepdftitle=false]{beamer}
\usetheme{boxes}
\usecolortheme{seahorse}

\title{Test}
\author{Silas Tittes}
\institute{\normalsize University of Colorado Boulder}
\date{\today}


\begin{document}
\SweaveOpts{concordance=TRUE}

\frame{
\hypersetup{pdfpageduration=2} %2 seconds
\titlepage
}


\begin{frame}[fragile]{Example Slide}
\hypersetup{pdfpageduration=2} %2 seconds
\begin{columns}
\begin{column}{0.4\linewidth}
\begin{itemize}
\item R includes a powerful and flexible system (Sweave) for creating dynamic reports and reproducible research using LaTeX.
\item Warning, more time will be spent tinkering with options than you ever thought would be possible.
\end{itemize}
\end{column}
\begin{column}{0.7\linewidth}

<<mtcarsplot, fig=TRUE, echo=FALSE>>=
par(cex.lab = 2.2, cex.axis = 1.5, mar = c(5,5,1,2))
plot(x = mtcars$mpg, y = mtcars$wt, 
     cex = 2.5*mtcars$hp/max(mtcars$hp), pch = 19, 
     xlab = "Car weight", ylab = "MPG")
@

\end{column}
\end{columns}
\end{frame}
\end{document}

答案 1 :(得分:0)

您可以使用\transduration{<seconds>}分别设置每张幻灯片的持续时间:

---
output: 
  beamer_presentation:
    keep_tex: true
---

# slide 1
\transduration{0.5}


# slide 2
\transduration{0.1}