Last active
August 29, 2015 13:56
-
-
Save kohske/9044996 to your computer and use it in GitHub Desktop.
knitr+animation+latex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{ltjsarticle} | |
\usepackage{luatexja} | |
\let\ifdraft\relax % おまじない | |
\usepackage{animate} | |
\title{PDFレポートでアニメーション} | |
\author{@kohske} | |
\begin{document} | |
\maketitle | |
\begin{figure}[h] | |
\centering | |
<<newton, include=FALSE, tidy=TRUE, echo=FALSE>>= | |
library(animation) | |
ani.options(outdir = getwd()) | |
saveLatex( | |
{ | |
ani.options(interval = 0.5) | |
par(mar = c(3, 3, 1, 1.5), mgp = c(1.5, 0.5, 0), pch = 19) | |
newton.method(function(x) 5 * x^3 - 7 * x^2 - 40 * x + 100, | |
7.15, c(-6.2, 7.1), main = "") | |
}, ani.dev = 'pdf', ani.type = 'pdf', img.name = "figure/animate-newton", | |
ani.height = 4, ani.width = 7, ani.opts='controls,width=.8\\linewidth', | |
install.animate=FALSE, pdflatex = "lualatex") | |
@ | |
\animategraphics[controls,width=.8\linewidth]{1}{figure/animate-newton}{}{} | |
\caption{saveLatexによるアニメーション} | |
\end{figure} | |
\end{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{ltjsarticle} | |
\usepackage{luatexja} | |
\pagestyle{empty} | |
\let\ifdraft\relax % おまじない | |
\usepackage{animate} | |
\title{PDFレポートでアニメーション} | |
\author{@kohske} | |
\begin{document} | |
\maketitle | |
\begin{figure}[h] | |
\centering | |
<<clock, fig.show="animate", out.width='.5\\linewidth', echo=FALSE>>= | |
par(mar = rep(3, 4)) | |
newton.method(function(x) 5 * x^3 - 7 * x^2 - 40 * x + 100, | |
7.15, c(-6.2, 7.1), main = "") | |
@ | |
\caption{saveLatexによるアニメーション} | |
\end{figure} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment