0

I'm just trying add some animation into my thesis, but pdf-backend still compliants to me, that requested file can't be found.

Also I would like to know how to proceed, if the image is not stored in the same directory. For attached MNWE, file is stored in same directory as compiled test.tex file.

If I am right, the syntax should be like (The number of frames need not be specified):

\animategraphics[<options>]{<frames per second>}{<name without extension>}{<first frame>}{<last frame>}

Compiled by:

  • lualatex --enable-write18 --shell-escape test.tex works NOK
  • pdflatex --enable-write18 --shell-escape test.tex works OK

MNWE

\documentclass{article}
\usepackage{graphicx}
\usepackage{animate}


\begin{document}
  text

  \begin{figure}
    \centering
   \animategraphics[controls,autoplay,loop]{2}{animation}{}{}
 \end{figure}

\end{document}

For sake of completens, I also try the answer in the similar post Animation using a sequence of images in a single pdf file, but the behavior is the same.

Code for generating PDF with 20 pages used for animation:

    % This animation helps explain the geometric interpretation of the 
    % definite integral.
    % http://texample.net/tikz/examples/animated-definite-integral/

    \documentclass[tikz]{standalone}
    \usepackage{tikz, pgf}
    \usepackage{multido}


    \begin{document}
    %
    \multido{\n=1+1}{20}{%
        \begin{tikzpicture}[scale=1.25]
        \draw[red,thick,<->] (-1,1) parabola bend (0,0) (2.1,4.41)
            node[below right] {\(y=x^2\)};
        \draw[loosely dotted] (-1,0) grid (4,4);
        \draw[->] (-0.2,0) -- (4.25,0) node[right] {\(x\)};
        \draw[->] (0,-0.25) -- (0,4.25) node[above] {\(y\)};
        \foreach \x/\xtext in {1/1, 2/2, 3/3}
        \draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {\(\xtext\)};
        \foreach \y/\ytext in {1/1, 2/2, 3/3, 4/4}
        \draw[shift={(0,\y)}] (2pt,0pt) -- (-2pt,0pt) node[left] {\(\ytext\)};
    %
        \def\mc{\n*\n}
        \pgfmathsetmacro\result{int(\n*\n*\n)}
        \shade[top color=blue,bottom color=gray!50]
            (0,0) parabola (0.1*\n,0.01*\mc) |- (0,0);
        \node[draw, fill=white] at (3cm,2cm) 
        {\(\int\limits_0^{\frac{\n}{10}}\!\!x^2\mathrm{d}x = \frac{\result}{3000}\)};
        \draw[fill=black,color=black] (0.1*\n,0.01*\mc) circle (1.2pt);
        \end{tikzpicture}
    }
    \end{document}
  • The command looks correct. Does a simple \includegraphics{animation} find the file? (Its name should be animation.pdf, obviously a multipage PDF.) – AlexG Nov 25 '19 at 12:01
  • You may use \graphicspath{...} to extend the list of paths to be searched for graphics files. – AlexG Nov 25 '19 at 12:09
  • Also, case matters: aniMation.PDF might not be found. – AlexG Nov 25 '19 at 12:24
  • @AlexG doesn't work for me either with lualatex (pdflatex is fine). – Ulrike Fischer Nov 25 '19 at 12:49
  • 1
    @Ulrike lualatex fails for some reason, that's new: due to recent changes of grf*-related pkgs or the renewed l2e format, perhaps? On the other hand, no problem with pdflatex and xelatex... – AlexG Nov 25 '19 at 13:31
2

Luatex and pdftex handle quoted file names differently. A work-around (until animate is corrected) could be

\documentclass{article}
\usepackage{graphicx}
\usepackage{animate}
\makeatletter
\def\@anim@getpagecount#1#2#3{%
    \edef\@anim@tempfilename{\noexpand\unquote@name{#1.#2}}%
    \pdfximage page 1 {\@anim@tempfilename}\xdef#3{\the\pdflastximagepages}%
  }
\makeatother
\begin{document}
  text

  \begin{figure}
    \centering
   \animategraphics[controls,autoplay,loop]{2}{example-image-duck}{}{}
 \end{figure}

\end{document}
  • 1
    Thank you for investigating this and providing a fix! – AlexG Nov 25 '19 at 15:18
  • In the meantime, the fix should have been propagated to all mirrors of CTAN, TeXLive and MiKTeX. Thanks again. – AlexG Dec 1 '19 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.