[latex3-commits] [git/LaTeX3-latex3-latex2e] gh776: Fix locating files with \graphicspath... again (99bd30c9)
PhelypeOleinik
phelype.oleinik at latex-project.org
Mon Feb 28 23:55:31 CET 2022
Repository : https://github.com/latex3/latex2e
On branch : gh776
Link : https://github.com/latex3/latex2e/commit/99bd30c9d381da144efcdf728c361744ba62753b
>---------------------------------------------------------------
commit 99bd30c9d381da144efcdf728c361744ba62753b
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Mon Feb 28 19:55:31 2022 -0300
Fix locating files with \graphicspath... again
Fixes #776
>---------------------------------------------------------------
99bd30c9d381da144efcdf728c361744ba62753b
base/changes.txt | 9 +++--
base/ltfilehook.dtx | 42 ++++++++++++++++++++--
required/graphics/changes.txt | 6 ++--
required/graphics/graphics.dtx | 13 +++----
.../{github-0776.lvt => github-0776b.lvt} | 7 ++--
required/graphics/testfiles/github-0776b.tlg | 6 ++++
6 files changed, 64 insertions(+), 19 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index 0768de67..7dd0ec9c 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -7,6 +7,11 @@ completeness or accuracy and it contains some references to files that
are not part of the distribution.
================================================================================
+2021-12-31 Phelype Oleinik <phelype.oleinik at latex-project.org>
+
+ * ltfilehook.dtx (subsection{Selecting a file (\cs{set at curr@file})}):
+ Add \set at curr@file at nosearch, to ignore \input at path and \l_file_search_path_seq.
+
2022-02-05 Joseph Wright <Joseph.Wright at latex-project.org>
* ltkeys.dtx (section{Plain \TeX}):
@@ -34,12 +39,12 @@ are not part of the distribution.
* ltexpl.dtx (section{Document-level command names for expl3 functions}):
Adjust document-level names for \exp_args:Nc and the like
-2021-12-30 Ulrike Fischer <Ulrike.Fischer at latex-project.org>
+2021-12-30 Ulrike Fischer <Ulrike.Fischer at latex-project.org>
* ltmeta.dtx:
Adapted bundle name to new name `LaTeX-lab'
-2021-12-31 Phelype Oleinik <phelype.oleinik at latex-project.org>
+2021-12-31 Phelype Oleinik <phelype.oleinik at latex-project.org>
* ltcmd.dtx (subsubsection{Showing the definition of a command}):
Make \ShowCommand stop for interaction with ltcmd (gh/739)
diff --git a/base/ltfilehook.dtx b/base/ltfilehook.dtx
index 533aacbf..46fed199 100644
--- a/base/ltfilehook.dtx
+++ b/base/ltfilehook.dtx
@@ -1046,7 +1046,8 @@
%
% \subsection{Selecting a file (\cs{set at curr@file})}
%
-% \begin{macro}{\set at curr@file,\@curr at file,\@curr at file@reqd}
+% \begin{macro}{\set at curr@file,\set at curr@file at nosearch}
+% \begin{macro}{\@curr at file,\@curr at file@reqd}
% \changes{v1.0f}{2021/01/31}{set \cs{protect} to \cs{string} gh/481}
% Now we hook into \cs{set at curr@file} to resolve a possible file
% substitution, and add \cs{@expl@@@filehook at set@curr at file@@nNN}
@@ -1073,10 +1074,18 @@
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
-%<latexrelease>\IncludeInRelease{2021/06/01}%
+%<latexrelease>\IncludeInRelease{2022/06/01}%
%<latexrelease> {\set at curr@file}{Setting current file name}%
-\def\set at curr@file#1{%
+\def\set at curr@file{%
+ \begingroup
+ \set at curr@file at aux}
+\def\set at curr@file at nosearch{%
\begingroup
+ \let\input at path\@empty
+ \csname seq_clear:N\expandafter\endcsname
+ \csname l_file_search_path_seq\endcsname
+ \set at curr@file at aux}
+\def\set at curr@file at aux#1{%
\escapechar\m at ne
\let\protect\string
\edef~{\string~}%
@@ -1117,6 +1126,32 @@
% \end{macrocode}
%
% \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2021/06/01}%
+%<latexrelease> {\set at curr@file}{Setting current file name}%
+%<latexrelease>\def\set at curr@file#1{%
+%<latexrelease> \begingroup
+%<latexrelease> \escapechar\m at ne
+%<latexrelease> \let\protect\string
+%<latexrelease> \edef~{\string~}%
+%<latexrelease> \expandafter\def\csname\expandafter\endcsname
+%<latexrelease> \expandafter{\csname\endcsname}%
+%<latexrelease> \@expl@@@filehook at if@no at extension@@nTF{#1}%
+%<latexrelease> {\@tempswatrue}{\@tempswafalse}%
+%<latexrelease> \@kernel at make@file at csname\@curr at file
+%<latexrelease> \@expl@@@filehook at resolve@file at subst@@w {#1}%
+%<latexrelease> \@expl@@@filehook at if@file at replaced@@TF
+%<latexrelease> {\@kernel at make@file at csname\@curr at file@reqd
+%<latexrelease> \@expl@@@filehook at normalize@file at name@@w{#1}%
+%<latexrelease> \if at tempswa \@expl@@@filehook at drop@extension@@N\@curr at file@reqd \fi}%
+%<latexrelease> {\if at tempswa \@expl@@@filehook at drop@extension@@N\@curr at file \fi
+%<latexrelease> \global\let\@curr at file@reqd\@curr at file}%
+%<latexrelease> \@expl@@@filehook at clear@replacement at flag@@
+%<latexrelease> \endgroup}
+%<latexrelease>\let\set at curr@file at nosearch\set at curr@file
+%<latexrelease>\EndIncludeInRelease
+% \end{macrocode}
+%
+% \begin{macrocode}
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease> {\set at curr@file}{Setting current file name}%
%<latexrelease>\def\set at curr@file#1{%
@@ -1163,6 +1198,7 @@
%<*2ekernel>
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
%
%
diff --git a/required/graphics/changes.txt b/required/graphics/changes.txt
index aa8e73c5..15de37af 100644
--- a/required/graphics/changes.txt
+++ b/required/graphics/changes.txt
@@ -4,11 +4,11 @@ completeness or accuracy and it contains some references to files that
are not part of the distribution.
=======================================================================
-2022-02-05 Phelype Oleinik <phelype.oleinik at latex-project.org>
+2022-02-28 Phelype Oleinik <phelype.oleinik at latex-project.org>
* graphics.dtx:
- If no extension is given, remove path (possibly found from
- \input at path) inserted by \set at curr@file (gh/776).
+ Use \set at curr@file at nosearch to avoid premature inclusion of path
+ from \cs{graphicspath} (gh/776).
2022-01-06 Frank Mittelbach <Frank.Mittelbach at latex-project.org>
diff --git a/required/graphics/graphics.dtx b/required/graphics/graphics.dtx
index 5e270b7f..3504fef5 100644
--- a/required/graphics/graphics.dtx
+++ b/required/graphics/graphics.dtx
@@ -27,7 +27,7 @@
%<driver> \ProvidesFile{graphics.drv}
% \fi
% \ProvidesFile{graphics.dtx}
- [2022/02/05 v1.4e Standard LaTeX Graphics (DPC,SPQR)]
+ [2022/02/28 v1.4e Standard LaTeX Graphics (DPC,SPQR)]
%
% \iffalse
%<*driver>
@@ -1114,8 +1114,11 @@
%
% \changes{v1.3d}{2019/11/01}
% {\cs{curr at name} now unquoted}
+% \changes{v1.4e}{2022/02/28}
+% {Use \cs{set at curr@file at nosearch} to avoid premature inclusion of
+% path from \cs{graphicspath}}
% \begin{macrocode}
- \set at curr@file{#1}%
+ \set at curr@file at nosearch{#1}%
\expandafter\filename at parse\expandafter{\@curr at file}%
% \end{macrocode}
% If extension is |.gz| tack on to previous extension, eg |.eps.gz| if available.
@@ -1134,12 +1137,6 @@
\fi
\fi
\ifx\filename at ext\relax
-% \end{macrocode}
-% \changes{v1.4e}{2022/02/05}
-% {If no extension is given, remove path (possibly found from
-% \cs{input at path}) inserted by \cs{set at curr@file} (gh/776)}
-% \begin{macrocode}
- \let\filename at area\@empty
\@for\Gin at temp:=\Gin at extensions\do{%
\ifx\Gin at ext\relax
\Gin at getbase\Gin at temp
diff --git a/required/graphics/testfiles/github-0776.lvt b/required/graphics/testfiles/github-0776b.lvt
similarity index 71%
copy from required/graphics/testfiles/github-0776.lvt
copy to required/graphics/testfiles/github-0776b.lvt
index e9e3ed6e..e6518a32 100644
--- a/required/graphics/testfiles/github-0776.lvt
+++ b/required/graphics/testfiles/github-0776b.lvt
@@ -1,5 +1,5 @@
%
-% https://tex.stackexchange.com/q/630167
+% https://github.com/latex3/latex2e/issues/776#issuecomment-1053608790
%
% If a file 'meow.ps' exists in folder-a and 'meow.tex' exists
% in folder-b, and if a graphics file 'meow' (no extension) is
@@ -12,7 +12,8 @@
\START
-\graphicspath{{./folder-a/}{./folder-b/}}
-\sbox0{\includegraphics{meow}}
+\sbox0{\includegraphics{folder-a/meow.ps}}
+
+\sbox2{\includegraphics{folder-a/meow}}
\END
diff --git a/required/graphics/testfiles/github-0776b.tlg b/required/graphics/testfiles/github-0776b.tlg
new file mode 100644
index 00000000..599d7185
--- /dev/null
+++ b/required/graphics/testfiles/github-0776b.tlg
@@ -0,0 +1,6 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+File: folder-a/meow.ps Graphic file (type eps)
+<folder-a/meow.ps>
+File: folder-a/meow.ps Graphic file (type eps)
+ <folder-a/meow.ps>
More information about the latex3-commits
mailing list.