Problem with packages subfiles and import.sty after using TexLive Utility for updating
That is due to the recent addition to import.sty
:
% Check for "./" currdir, and make \import@path@fix ensure trailing /
(see third-last paragraph of the manual too).
I don't know why one would import from a null directory (is it to return to default path within nested \subimport
?) but it should not "fix" the path in that case. The rationale is just for convenience, because forgetting the trailing "/" in the path is a common mistake.
For immediate relief, put
\makeatletter \let\import@path@fix\@firstofone \makeatother
in your (main) document header, or at the very end of import.sty
. Or
remove this block from import.sty
:
% Check for "./" currdir, and make \import@path@fix ensure trailing /
\gdef\@gtempa{./}
\ifx\@gtempa\@currdir % *x style paths
\gdef\import@path@fix#1{\@ensure@one@trailing@slash#1////\delimiter}%
\gdef\@ensure@one@trailing@slash#1////#2\delimiter{#1/}%
\fi
--Donald Arseneau
The new import
package code mis-handles an empty path segment and looks in the root of the filesystem rather than the current directory and unfortunately subfiles
uses this form.
I think this gets back the previous behaviour.
\RequirePackage{import}
\makeatletter
\def\@sub@import#1#2#3{%
\begingroup
\protected@edef\@tempa{\endgroup
\let\noexpand\IfFileExists\noexpand#2%
\noexpand\@import \noexpand#1% param 1
{\@ifundefined{input@path}{}{\input@path}}% 2
{\@ifundefined{Ginput@path}{}{\Ginput@path}}% 3
{\import@path#3}{\import@path}% 4,5
{\ifx\IfFileExists\im@@IfFileExists \noexpand\im@@IfFileExists
\else \noexpand\IfFileExists \fi}}% 6
\if\relax#3\relax% need expansion, for eg \filename@area
\endgroup\expandafter#1%
\else
\expandafter\@tempa
\fi}
\makeatother
\documentclass[MWE.tex]{subfiles}
\begin{document}
MWE
\end{document}
A simpler test case for just the import
issue without involving subfiles
is
\begin{filecontents}{\jobname-input-test}
abc
\end{filecontents}
\documentclass{article}
\usepackage{import}
\makeatletter
\def\@sub@import#1#2#3{%
\begingroup
\protected@edef\@tempa{\endgroup
\let\noexpand\IfFileExists\noexpand#2%
\noexpand\@import \noexpand#1% param 1
{\@ifundefined{input@path}{}{\input@path}}% 2
{\@ifundefined{Ginput@path}{}{\Ginput@path}}% 3
{\import@path#3}{\import@path}% 4,5
{\ifx\IfFileExists\im@@IfFileExists \noexpand\im@@IfFileExists
\else \noexpand\IfFileExists \fi}}% 6
\if\relax#3\relax
\endgroup\expandafter#1%
\else
\expandafter\@tempa
\fi}
\makeatother
\begin{document}
\subimport{}{\jobname-input-test}
\end{document}
which gives
! LaTeX Error: File `zzz.aux' not found
with the new import
package without the patch in the \makeatletter
block.