You can't use `lastsavedimageresourcepages' in vertical mode. error using TexLive 2018 on Linux












3















Update:



Thanks for the comment below, adding the before lastsavedimageresourcepages in the MWE below worked! But why? I have thousands of places in all my latex files that uses this type of code without the in there and that always worked.



So now I have go find and edit each place and add the there? I do not understand why this change was made that will break current latex code.





Original question



The MWE below gives this error when compiled with lualatex only on Linux Manjaro with fresh installation of TL 2018 on Vbox I did last night.



The same file compiles with lualatex with no error on another Linux ubuntu but with TeXLive which I have no updated for may be one or 2 month. That is the only difference.



So it seems something broke in latest TL 2018? Notice that this MWE is only meant to work on lualatex and not with pdflatex. As saveimageresource is defined only when using lualatex.



documentclass[11pt]{article}
usepackage{hyperref}
usepackage{pgffor}
usepackage{graphicx}

begin{document}

saveimageresource{math_228A_HW1.pdf}%use any other PDF here to run
foreach n in {1,...,lastsavedimageresourcepages} % for lualatex
{
includegraphics[width=0.88textwidth,page=n]{math_228A_HW1}

}

end{document}


Example where it fails



When I compile this on Linux with latest TL 2018, I get error



>uname -a
Linux me-pc 4.19.13-1-MANJARO #1 SMP PREEMPT Sat Dec 29 15:43:56 UTC 2018 x86_64 GNU/Linux

>which lualatex
/usr/local/texlive/2018/bin/x86_64-linux/lualatex
>
>
>lualatex --version
This is LuaTeX, Version 1.07.0 (TeX Live 2018)

>lualatex foo.tex
This is LuaTeX, Version 1.07.0 (TeX Live 2018)
restricted system commands enabled.
(./foo.tex
LaTeX2e <2018-12-01>

luaotfload | main : initialization completed in 0.128 seconds
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size11.clo))
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty
(/usr/local/texlive/2018/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2018/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2018/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/url/url.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/hluatex.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgffor.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.te
x
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-li
sts.tex))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/ms/everyshi.sty))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/pgf.revision.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c
ode.tex))) (/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/math/pgfmath.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.
tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic
.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigo
nometric.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.rando
m.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.compa
rison.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.
code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round
.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.
code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integ
erarithmetics.code.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)
))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-def/luatex.def)))
(./foo.aux) (/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./foo.out) (./foo.out) ABD: EveryShipout initializing macros
(/usr/local/texlive/2018/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/grfext.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
! You can't use `lastsavedimageresourcepages' in vertical mode.
<argument> lastsavedimageresourcepages

l.15 }

?


Example where it works



When I compile this on another Linux running TL 2018 but not updated yet, it works and compiles with no error:



>uname -a
Linux DESKTOP-7OK6FOH 4.4.0-17763-Microsoft #194-Microsoft
Mon Dec 03 17:58:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux


>ls -l
total 584
-rwxrwxrwx 1 me me 325 Jan 24 02:03 foo.tex
-rwxrwxrwx 1 me me 594289 Jan 19 18:59 math_228A_HW1.pdf
>

>cat foo.tex
documentclass[11pt]{article}
usepackage{hyperref}
usepackage{pgffor}
usepackage{graphicx}

begin{document}

saveimageresource{math_228A_HW1.pdf}
foreach n in {1,...,lastsavedimageresourcepages} % for lualatex
{
includegraphics[width=0.88textwidth,page=n]{math_228A_HW1}

}
end{document}
>

>
>which lualatex
/usr/local/texlive/2018/bin/x86_64-linux/lualatex
>

>lualatex --version
This is LuaTeX, Version 1.07.0 (TeX Live 2018)

>lualatex foo.tex
This is LuaTeX, Version 1.07.0 (TeX Live 2018)
restricted system commands enabled.
(./foo.tex
LaTeX2e <2018-04-01> patch level 5

luaotfload | main : initialization completed in 0.168 seconds
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size11.clo))
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty
(/usr/local/texlive/2018/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2018/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2018/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/url/url.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/hluatex.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgffor.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.te
x
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-li
sts.tex))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/ms/everyshi.sty))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex))
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c
ode.tex))) (/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/math/pgfmath.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.
tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic
.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigo
nometric.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.rando
m.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.compa
rison.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.
code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round
.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.
code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integ
erarithmetics.code.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)
))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-def/luatex.def)))
No file foo.aux.
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
ABD: EveryShipout initializing macros
(/usr/local/texlive/2018/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/grfext.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
[1{/usr/local/texlive/2018/texmf-var/fonts/map/pdftex/updmap/pdftex.map}<./math
_228A_HW1.pdf>] [2<./math_228A_HW1.pdf>] [3<./math_228A_HW1.pdf>] [4<./math_228
A_HW1.pdf>] [5<./math_228A_HW1.pdf>] [6<./math_228A_HW1.pdf>] [7<./math_228A_HW
1.pdf>] [8<./math_228A_HW1.pdf>] [9<./math_228A_HW1.pdf>] [10<./math_228A_HW1.p
df>] [11<./math_228A_HW1.pdf>] [12<./math_228A_HW1.pdf>] [13<./math_228A_HW1.pd
f>] [14<./math_228A_HW1.pdf>] [15<./math_228A_HW1.pdf>] [16<./math_228A_HW1.pdf
>] [17<./math_228A_HW1.pdf>] [18<./math_228A_HW1.pdf>] [19<./math_228A_HW1.pdf>
] [20<./math_228A_HW1.pdf>] [21<./math_228A_HW1.pdf>] [22<./math_228A_HW1.pdf>]
(./foo.aux)

Package rerunfilecheck Warning: File `foo.out' has changed.
(rerunfilecheck) Rerun to get outlines right
(rerunfilecheck) or use package `bookmark'.

)
386 words of node memory still in use:
2 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 46 glue_spec
, 4 attribute_list, 1 write nodes
avail lists: 2:63,3:9,4:1,5:23,6:3,7:24,8:5,9:27
</usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.
otf>
Output written on foo.pdf (22 pages, 595632 bytes).
Transcript written on foo.log.
>


This is the file list on the TL 2018 that I just installed fresh:



*File List*
article.cls 2018/09/03 v1.4i Standard LaTeX document class
size11.clo 2018/09/03 v1.4i Standard LaTeX file (size option)
hyperref.sty 2018/11/30 v6.88e Hypertext links for LaTeX
hobsub-hyperref.sty 2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty 2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
hobsub.sty 2016/05/16 v1.14 Construct package bundles (HO)
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
ifvtex.sty 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
intcalc.sty 2016/05/16 v1.2 Expandable calculations with integers (HO)
ifpdf.sty 2018/09/07 v3.3 Provides the ifpdf switch
etexcmds.sty 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty 2016/05/16 v1.17 Key value parser (HO)
kvdefinekeys.sty 2016/05/16 v1.4 Define keys (HO)
luatex-loader.sty 2016/05/16 v0.6 Lua module loader (HO)
pdftexcmds.sty 2018/09/10 v0.29 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty 2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2016/05/16 v1.4 Expandable calculations on big integers (HO)
bitset.sty 2016/05/16 v1.2 Handle bit-vector datatype (HO)
uniquecounter.sty 2016/05/16 v1.3 Provide unlimited unique counter (HO)
letltxmacro.sty 2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
hopatch.sty 2016/05/16 v1.3 Wrapper for package hooks (HO)
xcolor-patch.sty 2016/05/16 xcolor patch
atveryend.sty 2016/05/16 v1.9 Hooks at the very end of document (HO)
atbegshi.sty 2016/06/09 v1.18 At begin shipout hook (HO)
refcount.sty 2016/05/16 v3.5 Data extraction from label references (HO)
hycolor.sty 2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
auxhook.sty 2016/05/16 v1.4 Hooks for auxiliary files (HO)
kvoptions.sty 2016/05/16 v3.12 Key value format for package options (HO)
pd1enc.def 2018/11/30 v6.88e Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
hluatex.def 2018/11/30 v6.88e Hyperref driver for luaTeX
rerunfilecheck.sty 2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
pgffor.sty 2019/01/05 v3.1 (3.1)
pgfrcs.sty 2019/01/05 v3.1 (3.1)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
graphicx.sty 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
luatex.def 2018/01/08 v1.0l Graphics/color driver for luatex
nameref.sty 2016/05/21 v2.44 Cross-referencing by name of section
gettitlestring.sty 2016/05/16 v1.5 Cleanup title references (HO)
foo.out
foo.out
supp-pdf.mkii
epstopdf-base.sty 2016/05/15 v2.6 Base part for package epstopdf
grfext.sty 2016/05/16 v1.2 Manage graphics extensions (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
***********


This is list of files on the other linux where it compiles OK and I have no yet updated TL on it:



 *File List*
article.cls 2014/09/29 v1.4h Standard LaTeX document class
size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
hyperref.sty 2018/11/30 v6.88e Hypertext links for LaTeX
hobsub-hyperref.sty 2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty 2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
hobsub.sty 2016/05/16 v1.14 Construct package bundles (HO)
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
ifvtex.sty 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
intcalc.sty 2016/05/16 v1.2 Expandable calculations with integers (HO)
ifpdf.sty 2018/09/07 v3.3 Provides the ifpdf switch
etexcmds.sty 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty 2016/05/16 v1.17 Key value parser (HO)
kvdefinekeys.sty 2016/05/16 v1.4 Define keys (HO)
luatex-loader.sty 2016/05/16 v0.6 Lua module loader (HO)
pdftexcmds.sty 2018/09/10 v0.29 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty 2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2016/05/16 v1.4 Expandable calculations on big integers (HO)
bitset.sty 2016/05/16 v1.2 Handle bit-vector datatype (HO)
uniquecounter.sty 2016/05/16 v1.3 Provide unlimited unique counter (HO)
letltxmacro.sty 2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
hopatch.sty 2016/05/16 v1.3 Wrapper for package hooks (HO)
xcolor-patch.sty 2016/05/16 xcolor patch
atveryend.sty 2016/05/16 v1.9 Hooks at the very end of document (HO)
atbegshi.sty 2016/06/09 v1.18 At begin shipout hook (HO)
refcount.sty 2016/05/16 v3.5 Data extraction from label references (HO)
hycolor.sty 2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
auxhook.sty 2016/05/16 v1.4 Hooks for auxiliary files (HO)
kvoptions.sty 2016/05/16 v3.12 Key value format for package options (HO)
pd1enc.def 2018/11/30 v6.88e Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
hluatex.def 2018/11/30 v6.88e Hyperref driver for luaTeX
rerunfilecheck.sty 2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
pgffor.sty 2013/12/13 v3.0.1a (rcs-revision 1.25)
pgfrcs.sty 2015/08/07 v3.0.1a (rcs-revision 1.31)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
graphicx.sty 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
luatex.def 2018/01/08 v1.0l Graphics/color driver for luatex
nameref.sty 2016/05/21 v2.44 Cross-referencing by name of section
gettitlestring.sty 2016/05/16 v1.5 Cleanup title references (HO)
foo.out
foo.out
supp-pdf.mkii
epstopdf-base.sty 2016/05/15 v2.6 Base part for package epstopdf
grfext.sty 2016/05/16 v1.2 Manage graphics extensions (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
***********

)


Looking at the versions above, I see that pgffor.sty was updated on :



  pgffor.sty    2019/01/05 v3.1 (3.1)
pgfrcs.sty 2019/01/05 v3.1 (3.1)


Could this be the problem?



Any pdf file can be used to run the above. Since I can't attach a PDF file here. So you can use any pdf file.



The code above has been working for very long time with no problem. It only failed now on the new linux after I did fresh install of latest TL 2018.










share|improve this question

























  • The above code is meant to work only on lualatex. It will not work on pdflatex. The saveimageresource only works on lualatex. I only use lualatex.

    – Nasser
    3 hours ago








  • 1





    I see. Try thelastsavedimageresourcepages.

    – Henri Menke
    3 hours ago











  • Probably the LuaTeX team fixed a bug: in any case, using low-level image stuff in a LaTeX document (not plain TeX) is pretty unusual.

    – Joseph Wright
    56 mins ago






  • 2





    sourceforge.net/p/pgf/bugs/507

    – Henri Menke
    38 mins ago






  • 2





    @Nasser Yes, primitives were renamed in LuaTeX 0.90: tug.org/TUGboat/tb37-1/tb115hagen-pdf.pdf

    – Henri Menke
    22 mins ago
















3















Update:



Thanks for the comment below, adding the before lastsavedimageresourcepages in the MWE below worked! But why? I have thousands of places in all my latex files that uses this type of code without the in there and that always worked.



So now I have go find and edit each place and add the there? I do not understand why this change was made that will break current latex code.





Original question



The MWE below gives this error when compiled with lualatex only on Linux Manjaro with fresh installation of TL 2018 on Vbox I did last night.



The same file compiles with lualatex with no error on another Linux ubuntu but with TeXLive which I have no updated for may be one or 2 month. That is the only difference.



So it seems something broke in latest TL 2018? Notice that this MWE is only meant to work on lualatex and not with pdflatex. As saveimageresource is defined only when using lualatex.



documentclass[11pt]{article}
usepackage{hyperref}
usepackage{pgffor}
usepackage{graphicx}

begin{document}

saveimageresource{math_228A_HW1.pdf}%use any other PDF here to run
foreach n in {1,...,lastsavedimageresourcepages} % for lualatex
{
includegraphics[width=0.88textwidth,page=n]{math_228A_HW1}

}

end{document}


Example where it fails



When I compile this on Linux with latest TL 2018, I get error



>uname -a
Linux me-pc 4.19.13-1-MANJARO #1 SMP PREEMPT Sat Dec 29 15:43:56 UTC 2018 x86_64 GNU/Linux

>which lualatex
/usr/local/texlive/2018/bin/x86_64-linux/lualatex
>
>
>lualatex --version
This is LuaTeX, Version 1.07.0 (TeX Live 2018)

>lualatex foo.tex
This is LuaTeX, Version 1.07.0 (TeX Live 2018)
restricted system commands enabled.
(./foo.tex
LaTeX2e <2018-12-01>

luaotfload | main : initialization completed in 0.128 seconds
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size11.clo))
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty
(/usr/local/texlive/2018/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2018/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2018/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/url/url.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/hluatex.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgffor.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.te
x
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-li
sts.tex))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/ms/everyshi.sty))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/pgf.revision.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c
ode.tex))) (/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/math/pgfmath.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.
tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic
.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigo
nometric.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.rando
m.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.compa
rison.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.
code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round
.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.
code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integ
erarithmetics.code.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)
))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-def/luatex.def)))
(./foo.aux) (/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./foo.out) (./foo.out) ABD: EveryShipout initializing macros
(/usr/local/texlive/2018/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/grfext.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
! You can't use `lastsavedimageresourcepages' in vertical mode.
<argument> lastsavedimageresourcepages

l.15 }

?


Example where it works



When I compile this on another Linux running TL 2018 but not updated yet, it works and compiles with no error:



>uname -a
Linux DESKTOP-7OK6FOH 4.4.0-17763-Microsoft #194-Microsoft
Mon Dec 03 17:58:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux


>ls -l
total 584
-rwxrwxrwx 1 me me 325 Jan 24 02:03 foo.tex
-rwxrwxrwx 1 me me 594289 Jan 19 18:59 math_228A_HW1.pdf
>

>cat foo.tex
documentclass[11pt]{article}
usepackage{hyperref}
usepackage{pgffor}
usepackage{graphicx}

begin{document}

saveimageresource{math_228A_HW1.pdf}
foreach n in {1,...,lastsavedimageresourcepages} % for lualatex
{
includegraphics[width=0.88textwidth,page=n]{math_228A_HW1}

}
end{document}
>

>
>which lualatex
/usr/local/texlive/2018/bin/x86_64-linux/lualatex
>

>lualatex --version
This is LuaTeX, Version 1.07.0 (TeX Live 2018)

>lualatex foo.tex
This is LuaTeX, Version 1.07.0 (TeX Live 2018)
restricted system commands enabled.
(./foo.tex
LaTeX2e <2018-04-01> patch level 5

luaotfload | main : initialization completed in 0.168 seconds
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size11.clo))
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty
(/usr/local/texlive/2018/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2018/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2018/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/url/url.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/hluatex.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgffor.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.te
x
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-li
sts.tex))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/ms/everyshi.sty))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex))
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c
ode.tex))) (/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/math/pgfmath.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.
tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic
.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigo
nometric.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.rando
m.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.compa
rison.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.
code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round
.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.
code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integ
erarithmetics.code.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)
))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-def/luatex.def)))
No file foo.aux.
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
ABD: EveryShipout initializing macros
(/usr/local/texlive/2018/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/grfext.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
[1{/usr/local/texlive/2018/texmf-var/fonts/map/pdftex/updmap/pdftex.map}<./math
_228A_HW1.pdf>] [2<./math_228A_HW1.pdf>] [3<./math_228A_HW1.pdf>] [4<./math_228
A_HW1.pdf>] [5<./math_228A_HW1.pdf>] [6<./math_228A_HW1.pdf>] [7<./math_228A_HW
1.pdf>] [8<./math_228A_HW1.pdf>] [9<./math_228A_HW1.pdf>] [10<./math_228A_HW1.p
df>] [11<./math_228A_HW1.pdf>] [12<./math_228A_HW1.pdf>] [13<./math_228A_HW1.pd
f>] [14<./math_228A_HW1.pdf>] [15<./math_228A_HW1.pdf>] [16<./math_228A_HW1.pdf
>] [17<./math_228A_HW1.pdf>] [18<./math_228A_HW1.pdf>] [19<./math_228A_HW1.pdf>
] [20<./math_228A_HW1.pdf>] [21<./math_228A_HW1.pdf>] [22<./math_228A_HW1.pdf>]
(./foo.aux)

Package rerunfilecheck Warning: File `foo.out' has changed.
(rerunfilecheck) Rerun to get outlines right
(rerunfilecheck) or use package `bookmark'.

)
386 words of node memory still in use:
2 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 46 glue_spec
, 4 attribute_list, 1 write nodes
avail lists: 2:63,3:9,4:1,5:23,6:3,7:24,8:5,9:27
</usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.
otf>
Output written on foo.pdf (22 pages, 595632 bytes).
Transcript written on foo.log.
>


This is the file list on the TL 2018 that I just installed fresh:



*File List*
article.cls 2018/09/03 v1.4i Standard LaTeX document class
size11.clo 2018/09/03 v1.4i Standard LaTeX file (size option)
hyperref.sty 2018/11/30 v6.88e Hypertext links for LaTeX
hobsub-hyperref.sty 2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty 2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
hobsub.sty 2016/05/16 v1.14 Construct package bundles (HO)
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
ifvtex.sty 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
intcalc.sty 2016/05/16 v1.2 Expandable calculations with integers (HO)
ifpdf.sty 2018/09/07 v3.3 Provides the ifpdf switch
etexcmds.sty 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty 2016/05/16 v1.17 Key value parser (HO)
kvdefinekeys.sty 2016/05/16 v1.4 Define keys (HO)
luatex-loader.sty 2016/05/16 v0.6 Lua module loader (HO)
pdftexcmds.sty 2018/09/10 v0.29 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty 2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2016/05/16 v1.4 Expandable calculations on big integers (HO)
bitset.sty 2016/05/16 v1.2 Handle bit-vector datatype (HO)
uniquecounter.sty 2016/05/16 v1.3 Provide unlimited unique counter (HO)
letltxmacro.sty 2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
hopatch.sty 2016/05/16 v1.3 Wrapper for package hooks (HO)
xcolor-patch.sty 2016/05/16 xcolor patch
atveryend.sty 2016/05/16 v1.9 Hooks at the very end of document (HO)
atbegshi.sty 2016/06/09 v1.18 At begin shipout hook (HO)
refcount.sty 2016/05/16 v3.5 Data extraction from label references (HO)
hycolor.sty 2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
auxhook.sty 2016/05/16 v1.4 Hooks for auxiliary files (HO)
kvoptions.sty 2016/05/16 v3.12 Key value format for package options (HO)
pd1enc.def 2018/11/30 v6.88e Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
hluatex.def 2018/11/30 v6.88e Hyperref driver for luaTeX
rerunfilecheck.sty 2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
pgffor.sty 2019/01/05 v3.1 (3.1)
pgfrcs.sty 2019/01/05 v3.1 (3.1)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
graphicx.sty 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
luatex.def 2018/01/08 v1.0l Graphics/color driver for luatex
nameref.sty 2016/05/21 v2.44 Cross-referencing by name of section
gettitlestring.sty 2016/05/16 v1.5 Cleanup title references (HO)
foo.out
foo.out
supp-pdf.mkii
epstopdf-base.sty 2016/05/15 v2.6 Base part for package epstopdf
grfext.sty 2016/05/16 v1.2 Manage graphics extensions (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
***********


This is list of files on the other linux where it compiles OK and I have no yet updated TL on it:



 *File List*
article.cls 2014/09/29 v1.4h Standard LaTeX document class
size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
hyperref.sty 2018/11/30 v6.88e Hypertext links for LaTeX
hobsub-hyperref.sty 2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty 2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
hobsub.sty 2016/05/16 v1.14 Construct package bundles (HO)
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
ifvtex.sty 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
intcalc.sty 2016/05/16 v1.2 Expandable calculations with integers (HO)
ifpdf.sty 2018/09/07 v3.3 Provides the ifpdf switch
etexcmds.sty 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty 2016/05/16 v1.17 Key value parser (HO)
kvdefinekeys.sty 2016/05/16 v1.4 Define keys (HO)
luatex-loader.sty 2016/05/16 v0.6 Lua module loader (HO)
pdftexcmds.sty 2018/09/10 v0.29 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty 2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2016/05/16 v1.4 Expandable calculations on big integers (HO)
bitset.sty 2016/05/16 v1.2 Handle bit-vector datatype (HO)
uniquecounter.sty 2016/05/16 v1.3 Provide unlimited unique counter (HO)
letltxmacro.sty 2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
hopatch.sty 2016/05/16 v1.3 Wrapper for package hooks (HO)
xcolor-patch.sty 2016/05/16 xcolor patch
atveryend.sty 2016/05/16 v1.9 Hooks at the very end of document (HO)
atbegshi.sty 2016/06/09 v1.18 At begin shipout hook (HO)
refcount.sty 2016/05/16 v3.5 Data extraction from label references (HO)
hycolor.sty 2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
auxhook.sty 2016/05/16 v1.4 Hooks for auxiliary files (HO)
kvoptions.sty 2016/05/16 v3.12 Key value format for package options (HO)
pd1enc.def 2018/11/30 v6.88e Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
hluatex.def 2018/11/30 v6.88e Hyperref driver for luaTeX
rerunfilecheck.sty 2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
pgffor.sty 2013/12/13 v3.0.1a (rcs-revision 1.25)
pgfrcs.sty 2015/08/07 v3.0.1a (rcs-revision 1.31)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
graphicx.sty 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
luatex.def 2018/01/08 v1.0l Graphics/color driver for luatex
nameref.sty 2016/05/21 v2.44 Cross-referencing by name of section
gettitlestring.sty 2016/05/16 v1.5 Cleanup title references (HO)
foo.out
foo.out
supp-pdf.mkii
epstopdf-base.sty 2016/05/15 v2.6 Base part for package epstopdf
grfext.sty 2016/05/16 v1.2 Manage graphics extensions (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
***********

)


Looking at the versions above, I see that pgffor.sty was updated on :



  pgffor.sty    2019/01/05 v3.1 (3.1)
pgfrcs.sty 2019/01/05 v3.1 (3.1)


Could this be the problem?



Any pdf file can be used to run the above. Since I can't attach a PDF file here. So you can use any pdf file.



The code above has been working for very long time with no problem. It only failed now on the new linux after I did fresh install of latest TL 2018.










share|improve this question

























  • The above code is meant to work only on lualatex. It will not work on pdflatex. The saveimageresource only works on lualatex. I only use lualatex.

    – Nasser
    3 hours ago








  • 1





    I see. Try thelastsavedimageresourcepages.

    – Henri Menke
    3 hours ago











  • Probably the LuaTeX team fixed a bug: in any case, using low-level image stuff in a LaTeX document (not plain TeX) is pretty unusual.

    – Joseph Wright
    56 mins ago






  • 2





    sourceforge.net/p/pgf/bugs/507

    – Henri Menke
    38 mins ago






  • 2





    @Nasser Yes, primitives were renamed in LuaTeX 0.90: tug.org/TUGboat/tb37-1/tb115hagen-pdf.pdf

    – Henri Menke
    22 mins ago














3












3








3








Update:



Thanks for the comment below, adding the before lastsavedimageresourcepages in the MWE below worked! But why? I have thousands of places in all my latex files that uses this type of code without the in there and that always worked.



So now I have go find and edit each place and add the there? I do not understand why this change was made that will break current latex code.





Original question



The MWE below gives this error when compiled with lualatex only on Linux Manjaro with fresh installation of TL 2018 on Vbox I did last night.



The same file compiles with lualatex with no error on another Linux ubuntu but with TeXLive which I have no updated for may be one or 2 month. That is the only difference.



So it seems something broke in latest TL 2018? Notice that this MWE is only meant to work on lualatex and not with pdflatex. As saveimageresource is defined only when using lualatex.



documentclass[11pt]{article}
usepackage{hyperref}
usepackage{pgffor}
usepackage{graphicx}

begin{document}

saveimageresource{math_228A_HW1.pdf}%use any other PDF here to run
foreach n in {1,...,lastsavedimageresourcepages} % for lualatex
{
includegraphics[width=0.88textwidth,page=n]{math_228A_HW1}

}

end{document}


Example where it fails



When I compile this on Linux with latest TL 2018, I get error



>uname -a
Linux me-pc 4.19.13-1-MANJARO #1 SMP PREEMPT Sat Dec 29 15:43:56 UTC 2018 x86_64 GNU/Linux

>which lualatex
/usr/local/texlive/2018/bin/x86_64-linux/lualatex
>
>
>lualatex --version
This is LuaTeX, Version 1.07.0 (TeX Live 2018)

>lualatex foo.tex
This is LuaTeX, Version 1.07.0 (TeX Live 2018)
restricted system commands enabled.
(./foo.tex
LaTeX2e <2018-12-01>

luaotfload | main : initialization completed in 0.128 seconds
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size11.clo))
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty
(/usr/local/texlive/2018/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2018/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2018/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/url/url.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/hluatex.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgffor.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.te
x
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-li
sts.tex))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/ms/everyshi.sty))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/pgf.revision.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c
ode.tex))) (/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/math/pgfmath.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.
tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic
.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigo
nometric.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.rando
m.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.compa
rison.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.
code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round
.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.
code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integ
erarithmetics.code.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)
))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-def/luatex.def)))
(./foo.aux) (/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./foo.out) (./foo.out) ABD: EveryShipout initializing macros
(/usr/local/texlive/2018/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/grfext.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
! You can't use `lastsavedimageresourcepages' in vertical mode.
<argument> lastsavedimageresourcepages

l.15 }

?


Example where it works



When I compile this on another Linux running TL 2018 but not updated yet, it works and compiles with no error:



>uname -a
Linux DESKTOP-7OK6FOH 4.4.0-17763-Microsoft #194-Microsoft
Mon Dec 03 17:58:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux


>ls -l
total 584
-rwxrwxrwx 1 me me 325 Jan 24 02:03 foo.tex
-rwxrwxrwx 1 me me 594289 Jan 19 18:59 math_228A_HW1.pdf
>

>cat foo.tex
documentclass[11pt]{article}
usepackage{hyperref}
usepackage{pgffor}
usepackage{graphicx}

begin{document}

saveimageresource{math_228A_HW1.pdf}
foreach n in {1,...,lastsavedimageresourcepages} % for lualatex
{
includegraphics[width=0.88textwidth,page=n]{math_228A_HW1}

}
end{document}
>

>
>which lualatex
/usr/local/texlive/2018/bin/x86_64-linux/lualatex
>

>lualatex --version
This is LuaTeX, Version 1.07.0 (TeX Live 2018)

>lualatex foo.tex
This is LuaTeX, Version 1.07.0 (TeX Live 2018)
restricted system commands enabled.
(./foo.tex
LaTeX2e <2018-04-01> patch level 5

luaotfload | main : initialization completed in 0.168 seconds
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size11.clo))
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty
(/usr/local/texlive/2018/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2018/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2018/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/url/url.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/hluatex.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgffor.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.te
x
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-li
sts.tex))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/ms/everyshi.sty))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex))
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c
ode.tex))) (/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/math/pgfmath.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.
tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic
.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigo
nometric.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.rando
m.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.compa
rison.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.
code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round
.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.
code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integ
erarithmetics.code.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)
))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-def/luatex.def)))
No file foo.aux.
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
ABD: EveryShipout initializing macros
(/usr/local/texlive/2018/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/grfext.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
[1{/usr/local/texlive/2018/texmf-var/fonts/map/pdftex/updmap/pdftex.map}<./math
_228A_HW1.pdf>] [2<./math_228A_HW1.pdf>] [3<./math_228A_HW1.pdf>] [4<./math_228
A_HW1.pdf>] [5<./math_228A_HW1.pdf>] [6<./math_228A_HW1.pdf>] [7<./math_228A_HW
1.pdf>] [8<./math_228A_HW1.pdf>] [9<./math_228A_HW1.pdf>] [10<./math_228A_HW1.p
df>] [11<./math_228A_HW1.pdf>] [12<./math_228A_HW1.pdf>] [13<./math_228A_HW1.pd
f>] [14<./math_228A_HW1.pdf>] [15<./math_228A_HW1.pdf>] [16<./math_228A_HW1.pdf
>] [17<./math_228A_HW1.pdf>] [18<./math_228A_HW1.pdf>] [19<./math_228A_HW1.pdf>
] [20<./math_228A_HW1.pdf>] [21<./math_228A_HW1.pdf>] [22<./math_228A_HW1.pdf>]
(./foo.aux)

Package rerunfilecheck Warning: File `foo.out' has changed.
(rerunfilecheck) Rerun to get outlines right
(rerunfilecheck) or use package `bookmark'.

)
386 words of node memory still in use:
2 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 46 glue_spec
, 4 attribute_list, 1 write nodes
avail lists: 2:63,3:9,4:1,5:23,6:3,7:24,8:5,9:27
</usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.
otf>
Output written on foo.pdf (22 pages, 595632 bytes).
Transcript written on foo.log.
>


This is the file list on the TL 2018 that I just installed fresh:



*File List*
article.cls 2018/09/03 v1.4i Standard LaTeX document class
size11.clo 2018/09/03 v1.4i Standard LaTeX file (size option)
hyperref.sty 2018/11/30 v6.88e Hypertext links for LaTeX
hobsub-hyperref.sty 2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty 2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
hobsub.sty 2016/05/16 v1.14 Construct package bundles (HO)
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
ifvtex.sty 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
intcalc.sty 2016/05/16 v1.2 Expandable calculations with integers (HO)
ifpdf.sty 2018/09/07 v3.3 Provides the ifpdf switch
etexcmds.sty 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty 2016/05/16 v1.17 Key value parser (HO)
kvdefinekeys.sty 2016/05/16 v1.4 Define keys (HO)
luatex-loader.sty 2016/05/16 v0.6 Lua module loader (HO)
pdftexcmds.sty 2018/09/10 v0.29 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty 2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2016/05/16 v1.4 Expandable calculations on big integers (HO)
bitset.sty 2016/05/16 v1.2 Handle bit-vector datatype (HO)
uniquecounter.sty 2016/05/16 v1.3 Provide unlimited unique counter (HO)
letltxmacro.sty 2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
hopatch.sty 2016/05/16 v1.3 Wrapper for package hooks (HO)
xcolor-patch.sty 2016/05/16 xcolor patch
atveryend.sty 2016/05/16 v1.9 Hooks at the very end of document (HO)
atbegshi.sty 2016/06/09 v1.18 At begin shipout hook (HO)
refcount.sty 2016/05/16 v3.5 Data extraction from label references (HO)
hycolor.sty 2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
auxhook.sty 2016/05/16 v1.4 Hooks for auxiliary files (HO)
kvoptions.sty 2016/05/16 v3.12 Key value format for package options (HO)
pd1enc.def 2018/11/30 v6.88e Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
hluatex.def 2018/11/30 v6.88e Hyperref driver for luaTeX
rerunfilecheck.sty 2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
pgffor.sty 2019/01/05 v3.1 (3.1)
pgfrcs.sty 2019/01/05 v3.1 (3.1)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
graphicx.sty 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
luatex.def 2018/01/08 v1.0l Graphics/color driver for luatex
nameref.sty 2016/05/21 v2.44 Cross-referencing by name of section
gettitlestring.sty 2016/05/16 v1.5 Cleanup title references (HO)
foo.out
foo.out
supp-pdf.mkii
epstopdf-base.sty 2016/05/15 v2.6 Base part for package epstopdf
grfext.sty 2016/05/16 v1.2 Manage graphics extensions (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
***********


This is list of files on the other linux where it compiles OK and I have no yet updated TL on it:



 *File List*
article.cls 2014/09/29 v1.4h Standard LaTeX document class
size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
hyperref.sty 2018/11/30 v6.88e Hypertext links for LaTeX
hobsub-hyperref.sty 2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty 2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
hobsub.sty 2016/05/16 v1.14 Construct package bundles (HO)
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
ifvtex.sty 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
intcalc.sty 2016/05/16 v1.2 Expandable calculations with integers (HO)
ifpdf.sty 2018/09/07 v3.3 Provides the ifpdf switch
etexcmds.sty 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty 2016/05/16 v1.17 Key value parser (HO)
kvdefinekeys.sty 2016/05/16 v1.4 Define keys (HO)
luatex-loader.sty 2016/05/16 v0.6 Lua module loader (HO)
pdftexcmds.sty 2018/09/10 v0.29 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty 2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2016/05/16 v1.4 Expandable calculations on big integers (HO)
bitset.sty 2016/05/16 v1.2 Handle bit-vector datatype (HO)
uniquecounter.sty 2016/05/16 v1.3 Provide unlimited unique counter (HO)
letltxmacro.sty 2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
hopatch.sty 2016/05/16 v1.3 Wrapper for package hooks (HO)
xcolor-patch.sty 2016/05/16 xcolor patch
atveryend.sty 2016/05/16 v1.9 Hooks at the very end of document (HO)
atbegshi.sty 2016/06/09 v1.18 At begin shipout hook (HO)
refcount.sty 2016/05/16 v3.5 Data extraction from label references (HO)
hycolor.sty 2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
auxhook.sty 2016/05/16 v1.4 Hooks for auxiliary files (HO)
kvoptions.sty 2016/05/16 v3.12 Key value format for package options (HO)
pd1enc.def 2018/11/30 v6.88e Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
hluatex.def 2018/11/30 v6.88e Hyperref driver for luaTeX
rerunfilecheck.sty 2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
pgffor.sty 2013/12/13 v3.0.1a (rcs-revision 1.25)
pgfrcs.sty 2015/08/07 v3.0.1a (rcs-revision 1.31)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
graphicx.sty 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
luatex.def 2018/01/08 v1.0l Graphics/color driver for luatex
nameref.sty 2016/05/21 v2.44 Cross-referencing by name of section
gettitlestring.sty 2016/05/16 v1.5 Cleanup title references (HO)
foo.out
foo.out
supp-pdf.mkii
epstopdf-base.sty 2016/05/15 v2.6 Base part for package epstopdf
grfext.sty 2016/05/16 v1.2 Manage graphics extensions (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
***********

)


Looking at the versions above, I see that pgffor.sty was updated on :



  pgffor.sty    2019/01/05 v3.1 (3.1)
pgfrcs.sty 2019/01/05 v3.1 (3.1)


Could this be the problem?



Any pdf file can be used to run the above. Since I can't attach a PDF file here. So you can use any pdf file.



The code above has been working for very long time with no problem. It only failed now on the new linux after I did fresh install of latest TL 2018.










share|improve this question
















Update:



Thanks for the comment below, adding the before lastsavedimageresourcepages in the MWE below worked! But why? I have thousands of places in all my latex files that uses this type of code without the in there and that always worked.



So now I have go find and edit each place and add the there? I do not understand why this change was made that will break current latex code.





Original question



The MWE below gives this error when compiled with lualatex only on Linux Manjaro with fresh installation of TL 2018 on Vbox I did last night.



The same file compiles with lualatex with no error on another Linux ubuntu but with TeXLive which I have no updated for may be one or 2 month. That is the only difference.



So it seems something broke in latest TL 2018? Notice that this MWE is only meant to work on lualatex and not with pdflatex. As saveimageresource is defined only when using lualatex.



documentclass[11pt]{article}
usepackage{hyperref}
usepackage{pgffor}
usepackage{graphicx}

begin{document}

saveimageresource{math_228A_HW1.pdf}%use any other PDF here to run
foreach n in {1,...,lastsavedimageresourcepages} % for lualatex
{
includegraphics[width=0.88textwidth,page=n]{math_228A_HW1}

}

end{document}


Example where it fails



When I compile this on Linux with latest TL 2018, I get error



>uname -a
Linux me-pc 4.19.13-1-MANJARO #1 SMP PREEMPT Sat Dec 29 15:43:56 UTC 2018 x86_64 GNU/Linux

>which lualatex
/usr/local/texlive/2018/bin/x86_64-linux/lualatex
>
>
>lualatex --version
This is LuaTeX, Version 1.07.0 (TeX Live 2018)

>lualatex foo.tex
This is LuaTeX, Version 1.07.0 (TeX Live 2018)
restricted system commands enabled.
(./foo.tex
LaTeX2e <2018-12-01>

luaotfload | main : initialization completed in 0.128 seconds
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size11.clo))
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty
(/usr/local/texlive/2018/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2018/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2018/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/url/url.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/hluatex.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgffor.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.te
x
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-li
sts.tex))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/ms/everyshi.sty))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/pgf.revision.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c
ode.tex))) (/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/math/pgfmath.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.
tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic
.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigo
nometric.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.rando
m.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.compa
rison.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.
code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round
.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.
code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integ
erarithmetics.code.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)
))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-def/luatex.def)))
(./foo.aux) (/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./foo.out) (./foo.out) ABD: EveryShipout initializing macros
(/usr/local/texlive/2018/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/grfext.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
! You can't use `lastsavedimageresourcepages' in vertical mode.
<argument> lastsavedimageresourcepages

l.15 }

?


Example where it works



When I compile this on another Linux running TL 2018 but not updated yet, it works and compiles with no error:



>uname -a
Linux DESKTOP-7OK6FOH 4.4.0-17763-Microsoft #194-Microsoft
Mon Dec 03 17:58:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux


>ls -l
total 584
-rwxrwxrwx 1 me me 325 Jan 24 02:03 foo.tex
-rwxrwxrwx 1 me me 594289 Jan 19 18:59 math_228A_HW1.pdf
>

>cat foo.tex
documentclass[11pt]{article}
usepackage{hyperref}
usepackage{pgffor}
usepackage{graphicx}

begin{document}

saveimageresource{math_228A_HW1.pdf}
foreach n in {1,...,lastsavedimageresourcepages} % for lualatex
{
includegraphics[width=0.88textwidth,page=n]{math_228A_HW1}

}
end{document}
>

>
>which lualatex
/usr/local/texlive/2018/bin/x86_64-linux/lualatex
>

>lualatex --version
This is LuaTeX, Version 1.07.0 (TeX Live 2018)

>lualatex foo.tex
This is LuaTeX, Version 1.07.0 (TeX Live 2018)
restricted system commands enabled.
(./foo.tex
LaTeX2e <2018-04-01> patch level 5

luaotfload | main : initialization completed in 0.168 seconds
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size11.clo))
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty
(/usr/local/texlive/2018/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2018/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2018/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/url/url.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/hluatex.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgffor.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.te
x
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-li
sts.tex))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/ms/everyshi.sty))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex))
(/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c
ode.tex))) (/usr/local/texlive/2018/texmf-dist/tex/latex/pgf/math/pgfmath.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.
tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic
.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigo
nometric.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.rando
m.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.compa
rison.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.
code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round
.code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.
code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integ
erarithmetics.code.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)
))
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
(/usr/local/texlive/2018/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-def/luatex.def)))
No file foo.aux.
(/usr/local/texlive/2018/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
ABD: EveryShipout initializing macros
(/usr/local/texlive/2018/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/grfext.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
[1{/usr/local/texlive/2018/texmf-var/fonts/map/pdftex/updmap/pdftex.map}<./math
_228A_HW1.pdf>] [2<./math_228A_HW1.pdf>] [3<./math_228A_HW1.pdf>] [4<./math_228
A_HW1.pdf>] [5<./math_228A_HW1.pdf>] [6<./math_228A_HW1.pdf>] [7<./math_228A_HW
1.pdf>] [8<./math_228A_HW1.pdf>] [9<./math_228A_HW1.pdf>] [10<./math_228A_HW1.p
df>] [11<./math_228A_HW1.pdf>] [12<./math_228A_HW1.pdf>] [13<./math_228A_HW1.pd
f>] [14<./math_228A_HW1.pdf>] [15<./math_228A_HW1.pdf>] [16<./math_228A_HW1.pdf
>] [17<./math_228A_HW1.pdf>] [18<./math_228A_HW1.pdf>] [19<./math_228A_HW1.pdf>
] [20<./math_228A_HW1.pdf>] [21<./math_228A_HW1.pdf>] [22<./math_228A_HW1.pdf>]
(./foo.aux)

Package rerunfilecheck Warning: File `foo.out' has changed.
(rerunfilecheck) Rerun to get outlines right
(rerunfilecheck) or use package `bookmark'.

)
386 words of node memory still in use:
2 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 46 glue_spec
, 4 attribute_list, 1 write nodes
avail lists: 2:63,3:9,4:1,5:23,6:3,7:24,8:5,9:27
</usr/local/texlive/2018/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.
otf>
Output written on foo.pdf (22 pages, 595632 bytes).
Transcript written on foo.log.
>


This is the file list on the TL 2018 that I just installed fresh:



*File List*
article.cls 2018/09/03 v1.4i Standard LaTeX document class
size11.clo 2018/09/03 v1.4i Standard LaTeX file (size option)
hyperref.sty 2018/11/30 v6.88e Hypertext links for LaTeX
hobsub-hyperref.sty 2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty 2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
hobsub.sty 2016/05/16 v1.14 Construct package bundles (HO)
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
ifvtex.sty 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
intcalc.sty 2016/05/16 v1.2 Expandable calculations with integers (HO)
ifpdf.sty 2018/09/07 v3.3 Provides the ifpdf switch
etexcmds.sty 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty 2016/05/16 v1.17 Key value parser (HO)
kvdefinekeys.sty 2016/05/16 v1.4 Define keys (HO)
luatex-loader.sty 2016/05/16 v0.6 Lua module loader (HO)
pdftexcmds.sty 2018/09/10 v0.29 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty 2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2016/05/16 v1.4 Expandable calculations on big integers (HO)
bitset.sty 2016/05/16 v1.2 Handle bit-vector datatype (HO)
uniquecounter.sty 2016/05/16 v1.3 Provide unlimited unique counter (HO)
letltxmacro.sty 2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
hopatch.sty 2016/05/16 v1.3 Wrapper for package hooks (HO)
xcolor-patch.sty 2016/05/16 xcolor patch
atveryend.sty 2016/05/16 v1.9 Hooks at the very end of document (HO)
atbegshi.sty 2016/06/09 v1.18 At begin shipout hook (HO)
refcount.sty 2016/05/16 v3.5 Data extraction from label references (HO)
hycolor.sty 2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
auxhook.sty 2016/05/16 v1.4 Hooks for auxiliary files (HO)
kvoptions.sty 2016/05/16 v3.12 Key value format for package options (HO)
pd1enc.def 2018/11/30 v6.88e Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
hluatex.def 2018/11/30 v6.88e Hyperref driver for luaTeX
rerunfilecheck.sty 2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
pgffor.sty 2019/01/05 v3.1 (3.1)
pgfrcs.sty 2019/01/05 v3.1 (3.1)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
graphicx.sty 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
luatex.def 2018/01/08 v1.0l Graphics/color driver for luatex
nameref.sty 2016/05/21 v2.44 Cross-referencing by name of section
gettitlestring.sty 2016/05/16 v1.5 Cleanup title references (HO)
foo.out
foo.out
supp-pdf.mkii
epstopdf-base.sty 2016/05/15 v2.6 Base part for package epstopdf
grfext.sty 2016/05/16 v1.2 Manage graphics extensions (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
***********


This is list of files on the other linux where it compiles OK and I have no yet updated TL on it:



 *File List*
article.cls 2014/09/29 v1.4h Standard LaTeX document class
size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
hyperref.sty 2018/11/30 v6.88e Hypertext links for LaTeX
hobsub-hyperref.sty 2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty 2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
hobsub.sty 2016/05/16 v1.14 Construct package bundles (HO)
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
ifvtex.sty 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
intcalc.sty 2016/05/16 v1.2 Expandable calculations with integers (HO)
ifpdf.sty 2018/09/07 v3.3 Provides the ifpdf switch
etexcmds.sty 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty 2016/05/16 v1.17 Key value parser (HO)
kvdefinekeys.sty 2016/05/16 v1.4 Define keys (HO)
luatex-loader.sty 2016/05/16 v0.6 Lua module loader (HO)
pdftexcmds.sty 2018/09/10 v0.29 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty 2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2016/05/16 v1.4 Expandable calculations on big integers (HO)
bitset.sty 2016/05/16 v1.2 Handle bit-vector datatype (HO)
uniquecounter.sty 2016/05/16 v1.3 Provide unlimited unique counter (HO)
letltxmacro.sty 2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
hopatch.sty 2016/05/16 v1.3 Wrapper for package hooks (HO)
xcolor-patch.sty 2016/05/16 xcolor patch
atveryend.sty 2016/05/16 v1.9 Hooks at the very end of document (HO)
atbegshi.sty 2016/06/09 v1.18 At begin shipout hook (HO)
refcount.sty 2016/05/16 v3.5 Data extraction from label references (HO)
hycolor.sty 2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
auxhook.sty 2016/05/16 v1.4 Hooks for auxiliary files (HO)
kvoptions.sty 2016/05/16 v3.12 Key value format for package options (HO)
pd1enc.def 2018/11/30 v6.88e Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
hluatex.def 2018/11/30 v6.88e Hyperref driver for luaTeX
rerunfilecheck.sty 2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
pgffor.sty 2013/12/13 v3.0.1a (rcs-revision 1.25)
pgfrcs.sty 2015/08/07 v3.0.1a (rcs-revision 1.31)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
graphicx.sty 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
luatex.def 2018/01/08 v1.0l Graphics/color driver for luatex
nameref.sty 2016/05/21 v2.44 Cross-referencing by name of section
gettitlestring.sty 2016/05/16 v1.5 Cleanup title references (HO)
foo.out
foo.out
supp-pdf.mkii
epstopdf-base.sty 2016/05/15 v2.6 Base part for package epstopdf
grfext.sty 2016/05/16 v1.2 Manage graphics extensions (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
***********

)


Looking at the versions above, I see that pgffor.sty was updated on :



  pgffor.sty    2019/01/05 v3.1 (3.1)
pgfrcs.sty 2019/01/05 v3.1 (3.1)


Could this be the problem?



Any pdf file can be used to run the above. Since I can't attach a PDF file here. So you can use any pdf file.



The code above has been working for very long time with no problem. It only failed now on the new linux after I did fresh install of latest TL 2018.







epstopdf pgffor






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 1 hour ago







Nasser

















asked 4 hours ago









NasserNasser

8,18663183




8,18663183













  • The above code is meant to work only on lualatex. It will not work on pdflatex. The saveimageresource only works on lualatex. I only use lualatex.

    – Nasser
    3 hours ago








  • 1





    I see. Try thelastsavedimageresourcepages.

    – Henri Menke
    3 hours ago











  • Probably the LuaTeX team fixed a bug: in any case, using low-level image stuff in a LaTeX document (not plain TeX) is pretty unusual.

    – Joseph Wright
    56 mins ago






  • 2





    sourceforge.net/p/pgf/bugs/507

    – Henri Menke
    38 mins ago






  • 2





    @Nasser Yes, primitives were renamed in LuaTeX 0.90: tug.org/TUGboat/tb37-1/tb115hagen-pdf.pdf

    – Henri Menke
    22 mins ago



















  • The above code is meant to work only on lualatex. It will not work on pdflatex. The saveimageresource only works on lualatex. I only use lualatex.

    – Nasser
    3 hours ago








  • 1





    I see. Try thelastsavedimageresourcepages.

    – Henri Menke
    3 hours ago











  • Probably the LuaTeX team fixed a bug: in any case, using low-level image stuff in a LaTeX document (not plain TeX) is pretty unusual.

    – Joseph Wright
    56 mins ago






  • 2





    sourceforge.net/p/pgf/bugs/507

    – Henri Menke
    38 mins ago






  • 2





    @Nasser Yes, primitives were renamed in LuaTeX 0.90: tug.org/TUGboat/tb37-1/tb115hagen-pdf.pdf

    – Henri Menke
    22 mins ago

















The above code is meant to work only on lualatex. It will not work on pdflatex. The saveimageresource only works on lualatex. I only use lualatex.

– Nasser
3 hours ago







The above code is meant to work only on lualatex. It will not work on pdflatex. The saveimageresource only works on lualatex. I only use lualatex.

– Nasser
3 hours ago






1




1





I see. Try thelastsavedimageresourcepages.

– Henri Menke
3 hours ago





I see. Try thelastsavedimageresourcepages.

– Henri Menke
3 hours ago













Probably the LuaTeX team fixed a bug: in any case, using low-level image stuff in a LaTeX document (not plain TeX) is pretty unusual.

– Joseph Wright
56 mins ago





Probably the LuaTeX team fixed a bug: in any case, using low-level image stuff in a LaTeX document (not plain TeX) is pretty unusual.

– Joseph Wright
56 mins ago




2




2





sourceforge.net/p/pgf/bugs/507

– Henri Menke
38 mins ago





sourceforge.net/p/pgf/bugs/507

– Henri Menke
38 mins ago




2




2





@Nasser Yes, primitives were renamed in LuaTeX 0.90: tug.org/TUGboat/tb37-1/tb115hagen-pdf.pdf

– Henri Menke
22 mins ago





@Nasser Yes, primitives were renamed in LuaTeX 0.90: tug.org/TUGboat/tb37-1/tb115hagen-pdf.pdf

– Henri Menke
22 mins ago










1 Answer
1






active

oldest

votes


















3














What you are observing is a bug in PGF: https://sourceforge.net/p/pgf/bugs/507/



This is the broken commit: https://sourceforge.net/p/pgf/git/ci/acdfa1450bd2beda4d6865bb2717e4d6f628c875/



For now the workaround is either to prefix registers with the or restore an internal definition from an old version.



documentclass{article}
usepackage{pgffor}

makeatletter
defpgffor@dots@value@process#1{%
expandafterpgffor@dots@stripcontext#1pgffor@@stop%
expandafterpgffor@dots@charcheckpgffor@dotsvaluepgffor@@stop%
let#1=pgffor@dotsvalue%
}
makeatother

begin{document}
saveimageresource{example-image-a.pdf}
foreach n in {1,...,lastsavedimageresourcepages} { }
end{document}


However, then things like foreach n in {1,...,1e+1} { } will no longer work.






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f471587%2fyou-cant-use-lastsavedimageresourcepages-in-vertical-mode-error-using-texli%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    What you are observing is a bug in PGF: https://sourceforge.net/p/pgf/bugs/507/



    This is the broken commit: https://sourceforge.net/p/pgf/git/ci/acdfa1450bd2beda4d6865bb2717e4d6f628c875/



    For now the workaround is either to prefix registers with the or restore an internal definition from an old version.



    documentclass{article}
    usepackage{pgffor}

    makeatletter
    defpgffor@dots@value@process#1{%
    expandafterpgffor@dots@stripcontext#1pgffor@@stop%
    expandafterpgffor@dots@charcheckpgffor@dotsvaluepgffor@@stop%
    let#1=pgffor@dotsvalue%
    }
    makeatother

    begin{document}
    saveimageresource{example-image-a.pdf}
    foreach n in {1,...,lastsavedimageresourcepages} { }
    end{document}


    However, then things like foreach n in {1,...,1e+1} { } will no longer work.






    share|improve this answer






























      3














      What you are observing is a bug in PGF: https://sourceforge.net/p/pgf/bugs/507/



      This is the broken commit: https://sourceforge.net/p/pgf/git/ci/acdfa1450bd2beda4d6865bb2717e4d6f628c875/



      For now the workaround is either to prefix registers with the or restore an internal definition from an old version.



      documentclass{article}
      usepackage{pgffor}

      makeatletter
      defpgffor@dots@value@process#1{%
      expandafterpgffor@dots@stripcontext#1pgffor@@stop%
      expandafterpgffor@dots@charcheckpgffor@dotsvaluepgffor@@stop%
      let#1=pgffor@dotsvalue%
      }
      makeatother

      begin{document}
      saveimageresource{example-image-a.pdf}
      foreach n in {1,...,lastsavedimageresourcepages} { }
      end{document}


      However, then things like foreach n in {1,...,1e+1} { } will no longer work.






      share|improve this answer




























        3












        3








        3







        What you are observing is a bug in PGF: https://sourceforge.net/p/pgf/bugs/507/



        This is the broken commit: https://sourceforge.net/p/pgf/git/ci/acdfa1450bd2beda4d6865bb2717e4d6f628c875/



        For now the workaround is either to prefix registers with the or restore an internal definition from an old version.



        documentclass{article}
        usepackage{pgffor}

        makeatletter
        defpgffor@dots@value@process#1{%
        expandafterpgffor@dots@stripcontext#1pgffor@@stop%
        expandafterpgffor@dots@charcheckpgffor@dotsvaluepgffor@@stop%
        let#1=pgffor@dotsvalue%
        }
        makeatother

        begin{document}
        saveimageresource{example-image-a.pdf}
        foreach n in {1,...,lastsavedimageresourcepages} { }
        end{document}


        However, then things like foreach n in {1,...,1e+1} { } will no longer work.






        share|improve this answer















        What you are observing is a bug in PGF: https://sourceforge.net/p/pgf/bugs/507/



        This is the broken commit: https://sourceforge.net/p/pgf/git/ci/acdfa1450bd2beda4d6865bb2717e4d6f628c875/



        For now the workaround is either to prefix registers with the or restore an internal definition from an old version.



        documentclass{article}
        usepackage{pgffor}

        makeatletter
        defpgffor@dots@value@process#1{%
        expandafterpgffor@dots@stripcontext#1pgffor@@stop%
        expandafterpgffor@dots@charcheckpgffor@dotsvaluepgffor@@stop%
        let#1=pgffor@dotsvalue%
        }
        makeatother

        begin{document}
        saveimageresource{example-image-a.pdf}
        foreach n in {1,...,lastsavedimageresourcepages} { }
        end{document}


        However, then things like foreach n in {1,...,1e+1} { } will no longer work.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 2 mins ago

























        answered 29 mins ago









        Henri MenkeHenri Menke

        71.6k8158267




        71.6k8158267






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f471587%2fyou-cant-use-lastsavedimageresourcepages-in-vertical-mode-error-using-texli%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            SQL Server 17 - Attemping to backup to remote NAS but Access is denied

            Always On Availability groups resolving state after failover - Remote harden of transaction...

            Restoring from pg_dump with foreign key constraints