diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/tools/verbatim.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/tools/verbatim.dtx | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/Master/texmf-dist/source/latex/tools/verbatim.dtx b/Master/texmf-dist/source/latex/tools/verbatim.dtx index 121e2d4b39c..e62886e0033 100644 --- a/Master/texmf-dist/source/latex/tools/verbatim.dtx +++ b/Master/texmf-dist/source/latex/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} |