[latex3-commits] [git/LaTeX3-latex3-latex2e] gh776: Fix locating files with \graphicspath (2417dd9c)

PhelypeOleinik phelype.oleinik at latex-project.org
Sat Feb 5 23:51:06 CET 2022


Repository : https://github.com/latex3/latex2e
On branch  : gh776
Link       : https://github.com/latex3/latex2e/commit/2417dd9cf848e773f2066f29b9848d923ab4fd74

>---------------------------------------------------------------

commit 2417dd9cf848e773f2066f29b9848d923ab4fd74
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Sat Feb 5 19:51:06 2022 -0300

    Fix locating files with \graphicspath
    
    Fixes #776


>---------------------------------------------------------------

2417dd9cf848e773f2066f29b9848d923ab4fd74
 base/doc/ltnews35.tex                              | 16 +++++-
 required/graphics/changes.txt                      |  6 ++
 required/graphics/graphics.dtx                     |  8 ++-
 required/graphics/testfiles/github-0776.lvt        | 18 ++++++
 .../graphics/testfiles/github-0776.tlg             |  4 +-
 .../testfiles/support/{miau => folder-a/meow.ps}   |  0
 .../graphics/testfiles/support/folder-b/meow.tex   | 66 ++++++++++++++++++++++
 required/graphics/testfiles/utf8-filenames-002.lvt |  0
 8 files changed, 114 insertions(+), 4 deletions(-)

diff --git a/base/doc/ltnews35.tex b/base/doc/ltnews35.tex
index d4daf171..bf8687d5 100644
--- a/base/doc/ltnews35.tex
+++ b/base/doc/ltnews35.tex
@@ -327,7 +327,7 @@ layer)) which was also used in the example above.
 \subsection{A small update to \cs{obeylines} and \cs{obeyspaces}}
 
 The plain \TeX{} versions of \cs{obeylines} and \cs{obeyspaces} make
-\verb=^^M= and \verb*= = active and force them to execute \cs{par}
+\verb=^^M= and \verb*= = active and force them to execute \cs{par} %*
 and \cs{space}, respectively. Don Knuth makes a remark in the \TeX{}book
 that one can then use a trick such as
 \begin{verbatim}
@@ -576,6 +576,20 @@ This command is \emph{only} allowed in formulas.
 For details and further examples, see \file{mathcolor.pdf}.
 
 
+\subsection{Fix locating files with \cs{graphicspath}}
+%
+
+If a call to \cs{includegraphics} asked for a file (say, \file{image})
+without extension, and if both \file{A/image.pdf} and \file{B/image.tex}
+existed (both \file{A/} and \file{B/} in \cs{graphicspath}, but neither
+in a folder searched by kpse), then \file{A/image.pdf} would not be
+found, and a \enquote{file not found} error would be incorrectly thrown.
+The issue is now fixed and the graphics file is correctly found.
+%
+\githubissue{776}
+\sxissue{q/630167}
+
+
 \subsection{???}
 %
 \githubissue{???}
diff --git a/required/graphics/changes.txt b/required/graphics/changes.txt
index 5ec10ab1..aa8e73c5 100644
--- a/required/graphics/changes.txt
+++ b/required/graphics/changes.txt
@@ -4,6 +4,12 @@ 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>
+
+	* graphics.dtx:
+	If no extension is given, remove path (possibly found from
+	\input at path) inserted by \set at curr@file (gh/776).
+
 2022-01-06  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
 	* mathcolor.dtx:
diff --git a/required/graphics/graphics.dtx b/required/graphics/graphics.dtx
index c9b381ad..5e270b7f 100644
--- a/required/graphics/graphics.dtx
+++ b/required/graphics/graphics.dtx
@@ -27,7 +27,7 @@
 %<driver> \ProvidesFile{graphics.drv}
 % \fi
 %         \ProvidesFile{graphics.dtx}
-          [2021/03/04 v1.4d  Standard LaTeX Graphics (DPC,SPQR)]
+          [2022/02/05 v1.4e  Standard LaTeX Graphics (DPC,SPQR)]
 %
 % \iffalse
 %<*driver>
@@ -1134,6 +1134,12 @@
     \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-0776.lvt
new file mode 100644
index 00000000..e9e3ed6e
--- /dev/null
+++ b/required/graphics/testfiles/github-0776.lvt
@@ -0,0 +1,18 @@
+%
+% https://tex.stackexchange.com/q/630167
+%
+% 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
+% requested we have to make sure that the actual graphics file
+% is found instead of the .tex file (that may be found because
+% TeX assumes the .tex extension if no extension was given...)
+%
+\input{regression-test}
+\RequirePackage{graphics}
+
+\START
+
+\graphicspath{{./folder-a/}{./folder-b/}}
+\sbox0{\includegraphics{meow}}
+
+\END
diff --git a/base/testfiles-lthooks/github-0464.tlg b/required/graphics/testfiles/github-0776.tlg
similarity index 57%
copy from base/testfiles-lthooks/github-0464.tlg
copy to required/graphics/testfiles/github-0776.tlg
index fd6372fe..deda9be2 100644
--- a/base/testfiles-lthooks/github-0464.tlg
+++ b/required/graphics/testfiles/github-0776.tlg
@@ -1,4 +1,4 @@
 This is a generated file for the l3build validation system.
 Don't change this file in any respect.
-(testA.tex)
-After "testA.tex"
+File: ./folder-a//meow.ps Graphic file (type eps)
+<./folder-a//meow.ps>
diff --git a/required/graphics/testfiles/support/miau b/required/graphics/testfiles/support/folder-a/meow.ps
similarity index 100%
copy from required/graphics/testfiles/support/miau
copy to required/graphics/testfiles/support/folder-a/meow.ps
diff --git a/required/graphics/testfiles/support/folder-b/meow.tex b/required/graphics/testfiles/support/folder-b/meow.tex
new file mode 100644
index 00000000..0d38d11b
--- /dev/null
+++ b/required/graphics/testfiles/support/folder-b/meow.tex
@@ -0,0 +1,66 @@
+\documentclass[margin=1pt]{standalone}
+\usepackage{l3draw}
+\begin{document}
+\ExplSyntaxOn
+\fp_new:N \x \fp_new:N \y
+\cs_set:Npn \tmpa:w #1, #2, #3, #4, #5, #6,
+  {
+    \if_meaning:w \scan_stop: #1 \else:
+      \draw_path_curveto:nnn
+        { \x+#1, \y+#2 }
+        { \x+#3, \y+#4 }
+        { \x+#5, \y+#6 }
+      \fp_add:Nn \x {#5}
+      \fp_add:Nn \y {#6}
+      \exp_after:wN \tmpa:w
+    \fi:
+  }
+\draw_begin:
+  \draw_transform_yscale:n { -1 }
+  \draw_path_moveto:n { 0 , 0 }
+  \tmpa:w
+   -0.0773, 0.4808,-0.3817, 0.8886,-0.5363, 1.2170,
+    0.3557, 0.5870, 0.6876, 1.7290, 1.0680, 2.0080,
+   -0.0773, 0.0000, 0.7867, 0.6354,-0.3309, 0.5581,
+   -0.2784,-0.0991,-0.2784,-0.6601,-1.2960,-1.6760,
+   -0.1764, 0.0251, 0.1271, 1.1430, 0.4590, 1.4750,
+    0.5814, 0.5073,-0.4340, 0.3802,-0.4837, 0.3555,
+   -0.4053,-0.2536,-0.5319,-2.1100,-1.0930,-2.6960,
+   -0.2798,-0.3277,-0.6599,-0.2533,-0.9630,-0.2243,
+   -0.3818, 0.0977,-1.2980,-0.1033,-1.3230, 1.0150,
+    0.0247, 0.4797, 0.5608, 1.3440, 0.8141, 1.4950,
+    0.8616, 0.4836,-0.2822, 0.5084,-0.4093, 0.3566,
+   -0.2010,-0.2011,-0.5319,-0.6601,-0.8596,-1.0150,
+   -0.5377,-0.2797,-1.0170,-0.7098,-1.1440,-1.1690,
+   -0.3806, 0.0787,-0.7623, 0.2797,-0.8392, 0.6106,
+   -0.0787, 0.3566, 0.0769, 0.5814, 0.4297, 1.0900,
+    0.4095, 0.1020, 0.5362, 0.3073, 0.4095, 0.4096,
+   -0.0525, 0.0495,-0.8146, 0.1266,-0.8643, 0.0247,
+   -0.3073,-0.2038,-0.6601,-1.0400,-0.8392,-1.4990,
+   -0.1034,-0.2536,-0.4311,-0.9383, 0.1270,-1.6260,
+    0.1513,-0.2533, 0.1266,-0.7370, 0.0772,-1.0150,
+   -0.0772,-0.4561,-0.0772,-0.7373, 0.2286,-1.3450,
+   -0.9412,-0.8146,-2.5400,-2.3880,-0.9910,-4.4730,
+    0.1764,-0.1764, 0.6852,-0.3528, 0.4068, 0.3073,
+   -0.3324, 0.9136,-1.4470, 1.7010, 0.9369, 3.5560,
+    0.3817,-0.2537, 1.9580,-0.1020, 2.4910, 0.0000,
+    1.4750, 0.3030, 1.7780, 0.3030, 2.7930, 0.0493,
+    0.1284,-0.0493, 0.1531,-0.6832, 0.6850,-1.1180,
+   -0.0991,-0.3277, 0.5857,-0.7866, 0.6630,-1.1680,
+    0.1513,-0.3034, 0.5084, 0.6353, 0.5084, 0.6599,
+   -0.0276,-0.2010, 0.3528,-0.5817, 0.4053,-0.8116,
+    0.3277,-0.1020, 0.1034, 0.7126, 0.3817, 1.2210,
+    0.1513, 0.2010, 0.2784, 0.1517, 0.4297, 0.6354,
+    0.1270, 0.4794, 0.6601, 0.8885,-0.2010, 1.3430,
+   -0.4837, 0.2551,-0.6877, 0.2053,-1.0430, 0.3570,
+    0.0000, 0.2289,-0.0247, 0.7372,-0.0991, 1.0930,
+    \relax,,,,,,
+  \draw_path_close:
+  \draw_linewidth:n { .3563 }
+  \draw_miterlimit:n { 11.47 }
+  \draw_join_round:
+  \color_stroke:nn { HTML } { 231F20 }
+  \draw_path_use_clear:n { draw }
+\draw_end:
+\ExplSyntaxOff
+\end{document}





More information about the latex3-commits mailing list.