[latex3-commits] [git/LaTeX3-latex3-latex2e] gh223: Fixes to make filenames with spaces work with the xr-package (gh/223) (4ccfba6f)

Johannes Braams texniek at braams.xs4all.nl
Sun May 10 21:09:30 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : gh223
Link       : https://github.com/latex3/latex2e/commit/4ccfba6f0e1adb2b92e156b925f4d2ae03244e7e

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

commit 4ccfba6f0e1adb2b92e156b925f4d2ae03244e7e
Author: Johannes Braams <texniek at braams.xs4all.nl>
Date:   Sun May 10 21:09:30 2020 +0200

    Fixes to make filenames with spaces work with the xr-package (gh/223)


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

4ccfba6f0e1adb2b92e156b925f4d2ae03244e7e
 required/tools/changes.txt               |  6 ++++
 required/tools/testfiles/github-0223.lvt | 59 ++++++++++++++++++++++++++++++++
 required/tools/testfiles/github-0223.tlg | 12 +++++++
 required/tools/xr.dtx                    | 13 ++++---
 4 files changed, 86 insertions(+), 4 deletions(-)

diff --git a/required/tools/changes.txt b/required/tools/changes.txt
index 96050c40..fc18afe9 100644
--- a/required/tools/changes.txt
+++ b/required/tools/changes.txt
@@ -5,6 +5,12 @@ completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 =======================================================================
 
+2020-05-10  Johannes Braams  <Johannes.Braams at latex-project.org>
+
+	* xr.dtx: Remove leading and trailing spaces from the argument to
+	\externaldocument, making sure that spaces *in* filenames are
+	supprted (gh/217). 
+
 2020-04-22  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
 	* array.dtx (section{The line separator \\):
diff --git a/required/tools/testfiles/github-0223.lvt b/required/tools/testfiles/github-0223.lvt
new file mode 100644
index 00000000..49ae09d9
--- /dev/null
+++ b/required/tools/testfiles/github-0223.lvt
@@ -0,0 +1,59 @@
+% The external auxiliary files:
+\begin{filecontents}{file one.aux}
+relax 
+\@writefile{toc}{\contentsline {section}{\numberline {1}One}{1}\protected at file@percent }
+\newlabel{1one}{{1}{1}}
+\@writefile{toc}{\contentsline {section}{\numberline {2}Two}{1}\protected at file@percent }
+\newlabel{1two}{{2}{1}}
+\end{filecontents}
+% the .aux-file to be read
+\begin{filecontents}{file2.aux}
+\relax 
+\@writefile{toc}{\contentsline {section}{\numberline {1}One}{1}\protected at file@percent }
+\newlabel{2one}{{1}{1}}
+\@writefile{toc}{\contentsline {section}{\numberline {2}Two}{1}\protected at file@percent }
+\newlabel{2two}{{2}{1}}
+}
+\end{filecontents}
+\begin{filecontents}{file two.aux}
+\relax 
+\@writefile{toc}{\contentsline {section}{\numberline {1}One}{1}\protected at file@percent }
+\newlabel{2one}{{1}{1}}
+\@writefile{toc}{\contentsline {section}{\numberline {2}Two}{1}\protected at file@percent }
+\newlabel{2two}{{2}{1}}
+\end{filecontents}
+%
+% The actual test-file to show that the labels are imported from the
+% .auxilary files provided,
+%
+\documentclass{article}
+\input{test2e}
+\usepackage{xr}
+
+\START
+\AUTHOR{Johannes Braams}
+\FORMAT{LaTeX2e<2020-10-01>}
+\CLASS{article}
+\PACKAGE{xr}
+\externaldocument{"file one"}
+\externaldocument[nospace:]{file2}
+\externaldocument[space:]{ file2 }
+\externaldocument[midspace:]{file two}
+\OMIT
+\begin{document}
+\TIMO
+
+\section{Testing references}
+
+In \texttt{file1} there is a first label~\ref{1one} and a second
+label~\ref{1two} on page~\pageref{1one}.
+
+\texttt{File2} also has a first label~\ref{nospace:2one} and a second
+label~\ref{nospace:2two} on page~\pageref{nospace:2two}.
+
+\texttt{File2} also has a first label~\ref{space:2one} and a second
+label~\ref{space:2two} on page~\pageref{space:2two}.
+
+\texttt{File two} also has a first label~\ref{midspace:2one} and a second
+label~\ref{midspace:2two} on page~\pageref{midspace:2two}.
+\end{document}
diff --git a/required/tools/testfiles/github-0223.tlg b/required/tools/testfiles/github-0223.tlg
new file mode 100644
index 00000000..6a9879fc
--- /dev/null
+++ b/required/tools/testfiles/github-0223.tlg
@@ -0,0 +1,12 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+Author: Johannes Braams
+Format: LaTeX2e<2020-10-01>
+Main Class: article
+Package: xr
+Package xr Info: IMPORTING LABELS FROM file one.aux on input line ....
+Package xr Info: IMPORTING LABELS FROM file2.aux on input line ....
+Package xr Info: IMPORTING LABELS FROM file2.aux on input line ....
+Package xr Info: IMPORTING LABELS FROM file two.aux on input line ....
+[1
+] (github-0223.aux)
diff --git a/required/tools/xr.dtx b/required/tools/xr.dtx
index a6b2ffd8..a2dbea7c 100644
--- a/required/tools/xr.dtx
+++ b/required/tools/xr.dtx
@@ -25,7 +25,7 @@
 %
 %<package>\NeedsTeXFormat{LaTeX2e}
 %<package>\ProvidesPackage{xr}
-%<package>         [2019/07/22 v5.05 eXternal References (DPC)]
+%<package>         [2020-05-10 v5.06 eXternal References (DPC)]
 %
 %<*driver>
 \documentclass{ltxdoc}
@@ -103,12 +103,15 @@
 \let\externalcitedocument\externaldocument
 %    \end{macrocode}
 %
-% Save the optional prefix. Start processing the first |aux| file.
+%    Save the optional prefix. Start processing the first |aux| file.
+%  \changes{v5.06}{2020-05-10}{Remove leading and trailing sapces from
+%    the filename (gh/2223)}
 %    \begin{macrocode}
 \def\XR@[#1]#2{{%
   \makeatletter
   \def\XR at prefix{#1}%
-  \XR at next#2.aux\relax\\}}
+  \set at curr@file at trim@spaces{#2}%
+  \expandafter\XR at next\@curr at file.aux\relax\\}}
 %    \end{macrocode}
 %
 % Process the next |aux| file in the list and remove it from the head of
@@ -135,8 +138,10 @@
 % If the |aux| file exists, loop through line by line, looking for
 % |\newlabel| and |\@input|. Otherwise process the next file in the
 % list.
+%  \changes{v5.06}{2020-05-10}{Add braces around the filename to
+%    support filenames with spaces (gh/223)}
 %    \begin{macrocode}
-\def\XR at loop#1{\openin\@inputcheck#1\relax
+\def\XR at loop#1{\openin\@inputcheck{#1}\relax
   \ifeof\@inputcheck
     \PackageWarning{xr}{^^JNo file #1^^JLABELS NOT IMPORTED.^^J}%
     \expandafter\XR at aux





More information about the latex3-commits mailing list.