summaryrefslogtreecommitdiff
path: root/macros/latex/required/tools/verbatim.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-10-03 03:01:09 +0000
committerNorbert Preining <norbert@preining.info>2020-10-03 03:01:09 +0000
commit0e644e6805342838052f46e6af93f81644d0390b (patch)
tree26169230ce62dc353013ad08fb824f46d9511980 /macros/latex/required/tools/verbatim.dtx
parent37f9a57b2f39142fbccb20b758af8e0502499671 (diff)
CTAN sync 202010030301
Diffstat (limited to 'macros/latex/required/tools/verbatim.dtx')
-rw-r--r--macros/latex/required/tools/verbatim.dtx31
1 files changed, 24 insertions, 7 deletions
diff --git a/macros/latex/required/tools/verbatim.dtx b/macros/latex/required/tools/verbatim.dtx
index 121e2d4b39..e62886e003 100644
--- a/macros/latex/required/tools/verbatim.dtx
+++ b/macros/latex/required/tools/verbatim.dtx
@@ -69,6 +69,8 @@
%\fi
%
%
+% \changes{v1.5u}{2020-07-07}{Typo repair and added a missing comment
+% character}
% \changes{v1.5q}{2003/08/22}{Reintroduced \cs{@noligs}, by popular
% request.}
% \changes{v1.5i}{1996/06/04}{Move setting of verbatim font and
@@ -462,9 +464,12 @@
% the spacing.
% Then we open the file and set the category codes of all special
% characters:
+% \changes{v1.5t}{2020-07-05}{Added quotes around the filename in
+% order to allow a filename with spaces; also added a space and
+% comment-character to allow for thespace dlimited argument.}
% \begin{verbatim}
% \@bsphack
-% \immediate\openout \verbatim@out #1
+% \immediate\openout \verbatim@out "#1" %
% \let\do\@makeother\dospecials
% \catcode`\^^M\active
%\end{verbatim}
@@ -503,7 +508,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{verbatim}
- [2019/11/10 v1.5r LaTeX2e package for verbatim enhancements]
+ [2020-07-07 v1.5u LaTeX2e package for verbatim enhancements]
\@ifundefined{verbatim@@@}{}{\endinput}
% \end{macrocode}
%
@@ -1567,19 +1572,31 @@
% existence of file.}
% |\verbatim@input| first checks whether the file exists, using
% the standard macro |\IfFileExists| which leaves the name of the
-% file found in |\@filef@und|.
-% Then everything is set up as in the |\verbatim| macro.
+% file found in |\@filef@und|.
+% Then everything is set up as in the |\verbatim| macro. But, as
+% |\@verbatim| contains a call to |\every@verbatim| which
+% \emph{might} contain an |\input| statement, which would overwrite
+% the contents of |\@filef@und|, we need to save it by expanding it
+% first. The use of |\@swaptwoargs| makes it so that the
+% \emph{expansion} of |\@filef@und| gets to be the second argument
+% of |\verbatim@readfile|.
+% \changes{v1.5t}{2020-07-06}{Expand \cs{@filef@und} before the call
+% of \cs{@verbatim} (gh/222)}m
% \begin{macrocode}
\def\verbatim@input#1#2{%
- \IfFileExists {#2}{\@verbatim #1\relax
+ \IfFileExists {#2}{%
+ \expandafter\@swaptwoargs\expandafter
+ {\expandafter{\@filef@und}}%
+ {\@verbatim #1\relax
% \end{macrocode}
% Then it reads in the file, finishes off the \texttt{trivlist}
% environment started by |\@verbatim| and closes the group.
% This restores everything to its normal settings.
% \begin{macrocode}
- \verbatim@readfile{\@filef@und}\endtrivlist\endgroup\@doendpe}%
+ \verbatim@readfile}%
+ \endtrivlist\endgroup\@doendpe}%
% \end{macrocode}
-% If the file is not found a more or less helpful message is
+% If the file is not found a more or less helpful message is
% printed. The final |\endgroup| is needed to close the group
% started in |\verbatiminput| above.
% \begin{macrocode}