[Tex/LaTex] lualatex does not work with import/subimport when used in standalone setup

importluatexstandalone

Using TL 2015. I have this setup

main.tex
folderA/a.tex
        a.png

and using standalone to combine both documents. The file a.tex has an includesgraphics{a.png} where the file a.png is in the same folder as a.tex

I use standalone and import and subimport to combine both files into one file as documented. The above compiles ok with pdflatex but fails with lualatex.

MWE

main.tex

\documentclass[12pt,notitlepage]{article}
\usepackage{standalone}%  
\usepackage{import}  
\usepackage{graphicx}  

\begin{document}  
\subimport*{folderA/}{a}  
\end{document}

a.tex (in subfolder called folderA)

\documentclass[11pt]{article}%
\usepackage{standalone} 
\standalonetrue   
\usepackage{graphicx}  
\begin{document}
\includegraphics{a.png}  
\end{document}

Here is the result:

  pdflatex  main.tex
  ....
  Output written on main.pdf (1 page, 22036 bytes).
  Transcript written on main.log

No error. Now using lualatex:

lualatex main.tex
This is LuaTeX, Version beta-0.80.0 (TeX Live 2015) (rev 5238) 
 restricted \write18 enabled.
(./main.tex
....
(/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty))
(/usr/local/texlive/2015/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
(./folderA/a.tex

! Package pdftex.def Error: File `folderA/a.png' not found.

See the pdftex.def package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.7 \includegraphics{a.png}

I need to use lualatex for other reasons. Doing lualatex a.tex works with no error. But I need to combine them into one document and still use lualatex

Here is the file list (generated from pdflatex compile pass)

*File List*
 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size12.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
standalone.sty    2099/01/01 develop Package to include TeX sub-files with prea
mbles
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
 xkeyval.sty    2014/12/03 v2.7a package option processing (HA)
 xkeyval.tex    2014/12/03 v2.7a key=value parser (HA)
currfile.sty    2013/02/01 v0.7b Provides the file path elements of the current
 input file
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
filehook.sty    2011/10/12 v0.5d Hooks for input files
gincltex.sty    2011/09/04 v0.3 Include external LaTeX files like graphics
svn-prov.sty    2010/04/24 v3.1862 Package Date/Version from SVN Keywords
adjustbox.sty    2012/05/21 v1.0 Adjusting TeX boxes (trim, clip, ...)
 adjcalc.sty    2012/05/16 v1.1 Provides advanced setlength with multiple back-
ends (calc, etex, pgfmath)
trimclip.sty    2012/05/16 v1.0 Trim and clip general TeX material
graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2014/10/28 v1.0p Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
collectbox.sty    2012/05/17 v0.4b Collect macro arguments as boxes
tc-pdftex.def    2012/05/13 v1.0 Clipping driver for pdftex
ifoddpage.sty    2011/09/13 v1.0 Conditionals for odd/even page detection
varwidth.sty    2009/03/30 ver 0.92;  Variable-width minipages
filemod-expmin.sty    2011/09/19 v1.2 Get and compare file modification times (
expandable; minimal)
  import.sty    2009/03/23  v 5.1
supp-pdf.mkii
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
epstopdf-base.sty    2010/02/09 v2.5 Base part for package epstopdf
  grfext.sty    2010/08/19 v1.1 Manage graphics extensions (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
       a.tex
folderA/a.png

What is the problem and how to fix it? Does lualatex not work with import package?

references:

how-to-make-the-main-file-recognize-relative-paths-used-in-the-imported-files

ps. For your convenience, I put the above setup with all the files in this zip file here

Best Answer

The reason is that \pdftexversion in luaTeX is changed. As a workaround until pdftex.def is updated, try for example:

% main.tex
\documentclass[12pt,notitlepage]{article}
\usepackage{ifluatex}
\ifluatex\def\pdftexversion{140}\fi
... ...
Related Question