I have the following code:


It needs two images (Testsaves0 and Testsaves1) in the same folder. If I compile it with pdflatex, everything works and it is animated in Adobe Acrobat when I open it. The buttons work, too.

If I compile the same code with LuaLaTeX, it includes only the first image in the pdf, and nothing happens.

From the log files:


File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
)) <./Testsaves0.png> <./Testsaves1.png>
Package atveryend Info: Empty hook `BeforeClearDocument' on input line 6.


File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
Package atveryend Info: Empty hook `BeforeClearDocument' on input line 6.

System is a Windows 7 PC with TeXLive 2014 completely updated to today. I think it worked before, but I'm not 100% sure. I tried rolling the animate package back to my earliest backed up revision (35387) but that didn't change anything.

File List:

 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
 animate.sty    2014/12/04 PDF animations from files and inline graphics
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
  ifthen.sty    2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
atbegshi.sty    2011/10/05 v1.16 At begin shipout hook (HO)
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
 ifdraft.sty    2008/08/11 v1.3 Detect class options draft and final (HO)
    calc.sty    2014/10/28 v4.3 Infix arithmetic (KKT,FJ)
atenddvi.sty    2007/04/17 v1.1 At end DVI hook (HO)
zref-abspage.sty    2012/04/04 v2.24 Module abspage for zref (HO)
zref-base.sty    2012/04/04 v2.24 Module base for zref (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
luatex-loader.sty    2010/03/09 v0.4 Lua module loader (HO)
 auxhook.sty    2011/03/04 v1.3 Hooks for auxiliary files (HO)
zref-lastpage.sty    2012/04/04 v2.24 Module lastpage for zref (HO)
atveryend.sty    2011/06/30 v1.8 Hooks at the very end of document (HO)
  animfp.sty    2009/07/23 fixed point addition for animate.sty
graphics.sty    2014/10/28 v1.0p Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
epstopdf-base.sty    2010/02/09 v2.5 Base part for package epstopdf
  grfext.sty    2010/08/19 v1.1 Manage graphics extensions (HO)
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live

2 Answers 2


animate tests the graphics for identity to avoid to include the same file twice. This test fails for lualatex: The luatex implementation in pdftexcmds of \pdf@filemdfivesum seems to be faulty. I get the same values for the two graphics with lualatex but different values when I compile with pdflatex.

You can get around the problem by forcing animate to check only the file names. But I suggest to send Heiko Oberdiek a bug report.




  • I will send a bug report. Thanks for the workaround, it works great!
    – Juri Robl
    Dec 23, 2014 at 14:20
  • The problem seems that it only compares until it encounters a NULL byte.
    – Juri Robl
    Dec 23, 2014 at 14:37
  • This problem is Windows-only. I could verify this using a set of PNGs of mine. On Linux, the md5 sums are correctly calculated.
    – AlexG
    Jan 6, 2015 at 11:29
  • January 2018: The problem still occurs - I used the proposed solution from Ulrike and it works. Jan 24, 2018 at 19:32
  • Really!? This should be reported to the author of pdftexcmds package. Different file checksum computation by pdftex and Luatex is a major bug.
    – AlexG
    Jan 24, 2018 at 19:43

animate uses \pdf@filemdfivesum from the pdftexcmds package to avoid multiple inclusion of the same file. It calculates the MD5 check sum of files to be embedded.

The reported error occurs on Windows only.

The reason is that Windows distinguishes between opening files in text and binary mode. The C fopen() is mapped to Lua io.open() and uses the same argument list. The flag b (binary mode) should be added to the io.open() call to ensure correct reading of files on all platforms.

This patch fixes the problem:

--- texmf-dist/scripts/oberdiek/pdftexcmds.lua.orig
+++ texmf-dist/scripts/oberdiek/pdftexcmds.lua
@@ -250,7 +250,7 @@
       if not offset then
         offset = 0
-      local filehandle = io.open(foundfile, "r")
+      local filehandle = io.open(foundfile, "rb")
       if filehandle then
         if offset > 0 then
           filehandle:seek("set", offset)
@@ -270,7 +270,7 @@
 function filemdfivesum(filename)
   local foundfile = kpse.find_file(filename, "tex", true)
   if foundfile then
-    local filehandle = io.open(foundfile, "r")
+    local filehandle = io.open(foundfile, "rb")
     if filehandle then
       local contents = filehandle:read("*a")
  • January 2018: The problem still occurs - I used Ulrikes answer and it works. Jan 24, 2018 at 19:31
  • 1
    Ok, Ulrike's solution replaces file content checksum comparison by simple file name comparison. This doesn't prevent double inclusion if another file with different file name is actually a copy of a previously included file.
    – AlexG
    Jan 24, 2018 at 19:39
  • Thanks for replying. At the moment this is not a üproblem for me. I did not understand what I have to do with your answer and Ulrike's answer seemed easy to "implement". Maybe your solution will get "official" in the future since LuaLaTeX is getting more and more famous (I assume). Jan 24, 2018 at 19:59
  • 1
    this is fixed in github but ctan upload seems to be failing this evening, but expect it to appear there soon Jan 24, 2018 at 23:10
  • This is now installed at ctan Jan 26, 2018 at 15:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .