1 % \iffalse meta-comment
4 % The LaTeX3 Project and any individual authors listed elsewhere
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 % http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2005/12/01 or later.
18 % This file has the LPPL maintenance status "maintained".
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
24 % The list of derived (unpacked) files belonging to the distribution
25 % and covered by LPPL is defined by the unpacking scripts (with
26 % extension .ins) which are part of the distribution.
31 %%% From File: ltfiles.dtx
34 \ProvidesFile{ltfiles.dtx}
35 [2017/03/10 v1.1n LaTeX Kernel (File Handling)]
37 \documentclass{ltxdoc}
38 \GetFileInfo{ltfiles.dtx}
51 \MaintainedByLaTeXTeam{latex}
59 % \changes{v1.0h}{1994/05/21}{Use new error commands}
60 % \changes{v1.0n}{1994/11/17}
61 % {\cs{@tempa} to \cs{reserved@a}}
62 % \changes{v1.0u}{1995/07/13}{Updates to docu}
63 % \changes{v1.1m}{2015/02/21}
64 % {Removed autoload support}
66 % \section{File Handling}
68 % The following user commands are defined in this part:
70 % \DescribeMacro{\document} (ie |\begin{document}|)\\
71 % Reads in the .AUX files and |\catcode|'s |@| to 12.
73 % \DescribeMacro{\nofiles}\\
74 % Suppresses all file output by setting |\@filesw| false.
76 % \DescribeMacro{\includeonly}\marg{NAME1, ... ,NAMEn}\\
77 % Causes only parts NAME1, ... ,NAMEn to be read by
78 % their |\include| commands. Works by setting \@partsw true
79 % and setting |\@partlist| to NAME1, ... ,NAMEn.
81 % \DescribeMacro{\include}\marg{NAME}\\
82 % Does an |\input| NAME unless |\@partsw| is true and
83 % NAME is not in |\@partlist|. If |\@filesw| is true, then
84 % it directs .AUX output to NAME.AUX, including a
85 % checkpoint at the end.
87 % \DescribeMacro{\input}\marg{NAME}\\
88 % The same as TeX's |\input|, except it allows optional
89 % braces around the file name. In \LaTeXe, it also avoids
90 % the primitive `missing file' error, if the file can not be
93 % \DescribeMacro{\IfFileExists}\marg{NAME}\marg{then}\marg{else}\\
94 % If the file exists on the system, execute \emph{then} otherwise
95 % execute \emph{else}.
97 % \DescribeMacro{\InputIfFileExists}\marg{NAME}\marg{then}\marg{else}\\
98 % If the file exists on the system, execute \emph{then} and input
99 % \emph{NAME} otherwise execute \emph{else}.
103 % \changes{v1.0a}{1994/03/07}{Initial version, split from latex.dtx}
104 % \changes{v1.0a}{1994/03/07}{Long lines wrapped to 72 columns}
106 % \begin{oldcomments}
113 % VARIABLES, SWITCHES AND INTERNAL COMMANDS:
114 % \@mainaux : Output file number for main .AUX file.
115 % \@partaux : Output file number for current part's .AUX file.
116 % \@auxout : Either \@mainout or \@partout, depending on
117 % which .AUX file output goes to.
118 % \@input{foo} : If file foo exists, then \input's it,
119 % otherwise types a warning message.
120 % @filesw : Switch -- set false if no .AUX, .TOC, .IDX etc
121 % files are to be written
122 % @partsw : Set true by a \includeonly command.
123 % \@partlist : Set to the argument of the \includeonly command.
125 % \cp@FOO : The checkpoint for \include'd file FOO.TEX, written
126 % by \@writeckpt at the end of file FOO.AUX
129 % \includeonly{FILELIST} ==
132 % \@partlist := FILELIST
139 % then \immediate\write\@mainaux{\string\@input{FILE.AUX}}
142 % then \@tempswa := F
143 % \reserved@b == FILE
144 % for \reserved@a := \@partlist
145 % do if eval(\reserved@a) = eval(\reserved@b)
146 % then \@tempswa := T fi
151 % then \@auxout := \@partaux
153 % then \immediate\openout\@partaux{FILE.AUX}
154 % \immediate\write\@partaux{\relax}
159 % if @filesw then \closeout \@partaux fi
160 % \@auxout := \@mainaux
165 % \@writeckpt{FILE} ==
168 % \immediate\write on file \@partaux:
169 % \@setckpt{FILE}{ %% }
170 % for \reserved@a := \cl@@ckpt
171 % do \immediate\write on file \@partaux:
172 % \global\string\setcounter
173 % {eval(\reserved@a)}{eval(\c@eval(\reserved@a))}
175 % \immediate\write on file \@partaux: }
179 % \@setckpt{FILE}{LIST} ==
190 % \task{???}{Do we use @unused or mainaux?}
191 % \begin{macro}{\@inputcheck}
192 % \begin{macro}{\@unused}
193 % Allocate read stream for testing and output stream.
194 % \changes{v1.0l}{1994/11/07}
195 % {move here from ltdefns, remove duplicate \cs{@mainaux}}
203 % \begin{macro}{\@mainaux}
204 % \begin{macro}{\@partaux}
212 % \begin{macro}{\if@filesw}
213 % \begin{macro}{\if@partsw}
215 \newif\if@filesw \@fileswtrue
216 \newif\if@partsw \@partswfalse
221 % \begin{macro}{\@clubpenalty}
222 % This stores the current normal (non-infinite) value of
223 % \cs{clubpenalty}; it should therefore be reset whenever the
224 % normal value is changed (as in the bibliography in the standard
226 % \changes{v1.1h}{1996/10/05}{Added setting its value}
228 \newcount\@clubpenalty
229 \@clubpenalty \clubpenalty
233 % \begin{macro}{\document}
234 % \changes{v0.9e}{1993/12/09}{Hook added}
237 %<latexrelease>\IncludeInRelease{2017/03/10}%
238 %<latexrelease> {\document}{Save language for hyphenation}%
239 %<*2ekernel|latexrelease>
241 % Cancel the |\begingroup| from |\begin|.
243 \def\document{\endgroup
245 % If some options on |\documentclass| haven't been used by any
246 % package we will now give a warning since this is most certainly a
249 \ifx\@unusedoptionlist\@empty\else
250 \@latex@warning@no@line{Unused global option(s):^^J%
251 \@spaces[\@unusedoptionlist]}%
254 \@colroom\textheight \vsize\textheight
255 \columnwidth\textwidth
256 \@clubpenalty\clubpenalty
258 \advance\columnwidth -\columnsep
259 \divide\columnwidth\tw@ \hsize\columnwidth \@firstcolumntrue
261 \hsize\columnwidth \linewidth\hsize
262 \begingroup\@floatplacement\@dblfloatplacement
263 \makeatletter\let\@writefile\@gobbletwo
265 % \changes{v1.1a}{1995/10/24}
266 % {Removed multiplelabels switch}
268 \global \let \@multiplelabels \relax
269 \@input{\jobname.aux}%
272 \immediate\openout\@mainaux\jobname.aux
273 \immediate\write\@mainaux{\relax}%
277 % Dateline 1991/03/26: FMi added |\process@table| to support NFSS;
278 % This will also work with old lfonts if no other style defines
279 % |\process@table|. The following line forces the initialization of
283 \let\glb@currsize\@empty %% Force math initialization.
285 % \changes{v0.9t}{1994/01/31}
286 % {set \cs{@normalsize} or \cs{normalsize} if necessary}
287 % \changes{v1.0d}{1994/03/28}
288 % {(DPC) remove \cs{@normalsize check}}
289 % \changes{v1.0d}{1994/03/28}
290 % {(DPC) Use \cs{normalsize} not \cs{@normalsize}}
291 % \changes{v1.0g}{1994/05/13}{Added execution of \cs{every@size}}
292 % \changes{v1.0m}{1994/11/07}{Renamed \cs{every@size} to
293 % \cs{every@math@size}.}
294 % \changes{v1.0q}{1995/04/25}
295 % {Removed execution of \cs{every@size} latex/1407}
301 % So that punctuation in headings is not disturbed by verbatim
302 % or other local changes to the space factor codes, save the document
303 % default here. This will be locally reset by the output routine.
304 % For special cases a class may want to define |\normalsfcodes|
305 % directly, in case that definition will be used.
306 % (This is an old bug, problem existed in \LaTeX2.0x and plain \TeX.)
307 % \changes{v1.1k}{1997/04/14}
308 % {Set the document space factor defaults. latex/2404}
310 \ifx\normalsfcodes\@empty
312 \let\normalsfcodes\frenchspacing
314 \let\normalsfcodes\nonfrenchspacing
318 % For similar reasons also save the default language, this will be reset
319 % locally in the output routine. In particular it allows hyphenation
320 % in the page head even if the page break happens in verbatim.
321 % If this has already been set by a package, set to the value of |\language|
323 % \changes{v1.1n}{2017/03/10}{Save language default}
325 \ifx\document@default@language\m@ne
326 \chardef\document@default@language\language
330 % Way back in 1991 (08/26) FMi \& RmS set the |\@noskipsec| switch
331 % to true in the preamble and to false here.
332 % This was done to trap lists and related text in the preamble but it
333 % does not catch everything; hence Change 1.1g was introduced.
337 % \changes{v1.1a}{1995/10/24}
338 % {Removed refundefined switch}
340 \let \@refundefined \relax
342 % Just before disabling the preamble commands we execute the begin
343 % document hook which contains any code contributed by
344 % |\AtBeginDocument|. Also disable the gathering of the file list,
345 % if no |\listfiles| has been issued. |\AtBeginDocument| is redefined
346 % at this point so that and such commands that get into the hook do
347 % not chase their tail\ldots
348 % \changes{v1.1e}{1996/04/24}
349 % {(DPC) Reset \cs{AtBeginDocument} eg for latex/1297}
351 \let\AtBeginDocument\@firstofone
354 % Most of the following assignments will be done globally in case
355 % the user adds something like |\begin{multicols}| to the document
356 % hook, i.e. starts are group in |\begin{document}|.
357 % \changes{v1.0r}{1995/04/27}
358 % {Added \cs{global} to support groups in hook}
359 % \changes{v1.0c}{1994/03/16}
360 % {(DPC) directly add file list settings}
361 % \changes{v1.0v}{1995/08/16}{set \cs{topskip} globally}
362 % \changes{v1.0v}{1995/08/16}{set \cs{@maxdepth}}
364 % \changes{v1.0s}{1995/05/25}
365 % {Added check for \cs{topskip} zero}
366 % \changes{v1.0t}{1995/05/25}
368 % Since a value of exactly 0pt for \cs{topskip} causes
369 % \cs{twocolumn[]} to misbehave, we add this check, hoping
370 % that it will not cause any problems elsewhere.
372 \ifdim\topskip<1sp\global\topskip 1sp\relax\fi
373 \global\@maxdepth\maxdepth
374 \global\let\@begindocumenthook\@undefined
375 \ifx\@listfiles\@undefined
376 \global\let\@filelist\relax
377 \global\let\@addtofilelist\@gobble
380 % At the very end we disable all preamble commands. This has to
381 % happen after the begin document hooks was executed so that this
382 % hook can still use such commands.
383 % \changes{v0.9o}{1994/01/15}
384 % {move \cs{@preamblecmds} after document hook}
385 % \changes{v1.0v}{1995/08/16}{set \cs{do} globally}
387 \gdef\do##1{\global\let ##1\@notprerr}%
390 % The next line saves tokens and also allows |\@nodocument| to be
391 % used directly to trap preamble errors.
392 % \changes{v1.1g}{1996/09/29}{Added disabling of \cs{@nodocument}}
394 \global\let \@nodocument \relax
396 % The next line is a pure safety measure in case a do list is ever
397 % expanded at the wrong place. In addition it will save a few
398 % tokens to get rid of the above definition.
400 \global\let\do\noexpand
402 % \changes{v1.1c}{1995/12/05}{\cs{ignorespaces} added for latex/1933}
403 % Use of |\AtBeginDocument| hook might mean that we are already in
404 % horizontal mode, so ignore the space after |\begin{document}|.
407 %</2ekernel|latexrelease>
408 %<latexrelease>\EndIncludeInRelease
409 %<latexrelease>\IncludeInRelease{0000/00/00}%
410 %<latexrelease> {\document}{Save language for hyphenation}
411 %<latexrelease>\def\document{\endgroup
412 %<latexrelease> \ifx\@unusedoptionlist\@empty\else
413 %<latexrelease> \@latex@warning@no@line{Unused global option(s):^^J%
414 %<latexrelease> \@spaces[\@unusedoptionlist]}%
416 %<latexrelease> \@colht\textheight
417 %<latexrelease> \@colroom\textheight \vsize\textheight
418 %<latexrelease> \columnwidth\textwidth
419 %<latexrelease> \@clubpenalty\clubpenalty
420 %<latexrelease> \if@twocolumn
421 %<latexrelease> \advance\columnwidth -\columnsep
422 %<latexrelease> \divide\columnwidth\tw@ \hsize\columnwidth
423 %<latexrelease> \@firstcolumntrue
425 %<latexrelease> \hsize\columnwidth \linewidth\hsize
426 %<latexrelease> \begingroup\@floatplacement\@dblfloatplacement
427 %<latexrelease> \makeatletter\let\@writefile\@gobbletwo
428 %<latexrelease> \global \let \@multiplelabels \relax
429 %<latexrelease> \@input{\jobname.aux}%
430 %<latexrelease> \endgroup
431 %<latexrelease> \if@filesw
432 %<latexrelease> \immediate\openout\@mainaux\jobname.aux
433 %<latexrelease> \immediate\write\@mainaux{\relax}%
435 %<latexrelease> \process@table
436 %<latexrelease> \let\glb@currsize\@empty
437 %<latexrelease> \normalsize
438 %<latexrelease> \everypar{}%
439 %<latexrelease> \ifx\normalsfcodes\@empty
440 %<latexrelease> \ifnum\sfcode`\.=\@m
441 %<latexrelease> \let\normalsfcodes\frenchspacing
442 %<latexrelease> \else
443 %<latexrelease> \let\normalsfcodes\nonfrenchspacing
446 %<latexrelease> \@noskipsecfalse
447 %<latexrelease> \let \@refundefined \relax
448 %<latexrelease> \let\AtBeginDocument\@firstofone
449 %<latexrelease> \@begindocumenthook
450 %<latexrelease> \ifdim\topskip<1sp\global\topskip 1sp\relax\fi
451 %<latexrelease> \global\@maxdepth\maxdepth
452 %<latexrelease> \global\let\@begindocumenthook\@undefined
453 %<latexrelease> \ifx\@listfiles\@undefined
454 %<latexrelease> \global\let\@filelist\relax
455 %<latexrelease> \global\let\@addtofilelist\@gobble
457 %<latexrelease> \gdef\do##1{\global\let ##1\@notprerr}%
458 %<latexrelease> \@preamblecmds
459 %<latexrelease> \global\let \@nodocument \relax
460 %<latexrelease> \global\let\do\noexpand
461 %<latexrelease> \ignorespaces}
466 \@onlypreamble\document
470 % \begin{macro}{\normalsfcodes}
471 % \changes{v1.1k}{1997/04/14}
472 % {Macro added (from patch file) latex/2404}
473 % The setting of |\@empty| is just a flag. This command may be defined
474 % in a class or package file. If it is still |\@empty| at
475 % |\begin{document}| it will be defined to be |\frenchspacing| or
476 % |\nonfrenchspacing|, depending on which of those appears to be in
477 % effect at that point.
479 \let\normalsfcodes\@empty
483 % \begin{macro}{\nofiles}
484 % \changes{v1.0k}{1994/11/04}
485 % {Added setting of \cs{protected@write},
486 % \cs{makeindex} and \cs{makeglossary} to \cs{nofiles}. ASAJ.}
487 % \changes{v1.0o}{1994/11/30}
488 % {There is no \cs{@gobblethree}\ldots}
489 % \changes{v1.0t}{1995/05/25}
490 % {(CAR) added \cs{long}}
491 % \changes{v1.1f}{1996/05/17}
492 % {added \cs{write} to \cs{protected@write} for latex/2146}
493 % Set |\@fileswfalse| which suppresses the places where \LaTeX\ makes
494 % |\immediate| writes. The |\makeindex| and |\makeglossary| are
495 % disabled. |\protected@write| is redefined not to write to the file
496 % specified, but rather to write a blank line to the log file. This
497 % ensures that a \meta{whatsit} node is still created, and so spacing
498 % is not affected by the |\nofiles| command; to ensure this more
499 % generally, the |\if@nobreak| test is needed.
500 % \changes{v1.1i}{1996/11/05}
501 % {Standard \cs{if@nobreak} test added}
505 \typeout{No auxiliary output files.^^J}%
506 \long\def\protected@write##1##2##3%
507 {\write\m@ne{}\if@nobreak\ifvmode\nobreak\fi\fi}%
509 \let\makeglossary\relax}
510 \@onlypreamble\nofiles
515 % \begin{macro}{\protected@write}
516 % This takes three arguments: an output stream, some initialization
517 % code, and some text to write. It then writes this, with
518 % appropriate handling of |\protect| and |\thepage|.
519 % \changes{v1.0k}{1994/11/04}{Macro added ASAJ.}
520 % \changes{v1.0t}{1995/05/25}
521 % {(CAR) added \cs{long}}
523 \long\def \protected@write#1#2#3{%
527 \let\protect\@unexpandable@protect
528 \edef\reserved@a{\write#1{#3}}%
531 \if@nobreak\ifvmode\nobreak\fi\fi
537 \let\@auxout=\@mainaux
541 % \begin{macro}{\includeonly}
542 % \changes{v1.0p}{1995/04/22}{Allow blanks in argument}
546 \edef\@partlist{\zap@space#1 \@empty}}
547 \@onlypreamble\includeonly
551 % \begin{macro}{\include}
552 % \changes{v0.9p}{1994/01/18}
553 % {Use \cs{@input@} so include files are listed.}
554 % In the definition of |\include|, |\def\reserved@b| changed to
555 % |\edef\reserved@b| to be consistent with the |\edef| in
557 % (Suggested by Rainer Sch\"opf \& Frank Mittelbach.
558 % Change made 20 Jul 88.)
560 % Changed definition of |\include| to allow space at end of file name
561 % --- otherwise, typing |\include{foo }| would cause \LaTeX\ to
562 % overwrite |foo.tex|. Change made 24 May 89, suggested by Rainer
563 % Sch\"opf and Frank Mittelbach
565 % Made |\include| check for being used inside an |\include|'d file, as
566 % this will not work and cause surprising results.
568 \def\include#1{\relax
569 \ifnum\@auxout=\@partaux
570 \@latex@error{\string\include\space cannot be nested}\@eha
571 \else \@include#1 \fi}
575 % \begin{macro}{\@include}
580 \immediate\write\@mainaux{\string\@input{#1.aux}}%
585 \edef\reserved@b{#1}%
586 \@for\reserved@a:=\@partlist\do
587 {\ifx\reserved@a\reserved@b\@tempswatrue\fi}%
590 \let\@auxout\@partaux
592 \immediate\openout\@partaux #1.aux
593 \immediate\write\@partaux{\relax}%
599 \immediate\closeout\@partaux
603 % If the file is not included, reset |\deadcycles|, so that a long
604 % list of non-included files does not generate an `Output loop'
606 % \changes{v1.1j}{1997/01/08}{reset \cs{deadcycles} latex/2365}
611 \let\@auxout\@mainaux}
615 % \begin{macro}{\@writeckpt}
619 \immediate\write\@partaux{\string\@setckpt{#1}\@charlb}%
620 {\let\@elt\@wckptelt \cl@@ckpt}%
621 \immediate\write\@partaux{\@charrb}%
626 % \begin{macro}{\@wckptelt}
629 \immediate\write\@partaux{%
630 \string\setcounter{#1}{\the\@nameuse{c@#1}}}}
634 % \begin{macro}{\@setckpt}
635 % RmS 93/08/31: introduced |\@setckpt|
637 \def\@setckpt#1{\global\@namedef{cp@#1}}
641 % \begin{macro}{\@charlb}
642 % \begin{macro}{\@charrb}
643 % The following defines |\@charlb| and |\@charrb| to be |{| and |}|,
644 % respectively with |\catcode| 11.
646 {\catcode`[=1 \catcode`]=2
647 \catcode`{=11 \catcode`}=11
656 % \subsection{Safe Input Macros}
658 % \begin{macro}{\IfFileExists}
659 % \changes{v0.9b}{1993/12/04}{Macro added}
660 % \changes{v0.9p}{1994/01/18}{New Definition}
661 % \changes{v1.0t}{1995/05/25}
662 % {(CAR) added \cs{long}}
665 \long\def \IfFileExists#1#2#3{%
666 \openin\@inputcheck#1 %
668 \ifx\input@path\@undefined
671 \def\reserved@a{\@iffileonpath{#1}{#2}{#3}}%
675 \edef\@filef@und{#1 }%
681 % \begin{macro}{\@iffileonpath}
682 % If the file is not found by |\openin|, and |\input@path| is defined,
683 % look in all the directories specified in |\input@path|.
684 % \changes{v0.9p}{1994/01/18}{Macro added}
685 % \changes{v1.0f}{1994/05/02}
686 % {\cs{@break@loop} renamed to \cs{@break@tfor}}
687 % \changes{v1.0t}{1995/05/25}
688 % {(CAR) added \cs{long}}
689 % \changes{v1.1d}{1996/01/10}
690 % {Change argument handling to not require doubled hash. latex/2024}
692 \long\def\@iffileonpath#1{%
693 \let\reserved@a\@secondoftwo
694 \expandafter\@tfor\expandafter\reserved@b\expandafter
695 :\expandafter=\input@path\do{%
696 \openin\@inputcheck\reserved@b#1 %
697 \ifeof\@inputcheck\else
698 \edef\@filef@und{\reserved@b#1 }%
699 \let\reserved@a\@firstoftwo%
708 % \begin{macro}{\InputIfFileExists}
710 % {1993/12/04}{Macro added}
712 % {1994/01/18}{New Definition}
713 % \changes{v0.3b}{1994/03/13}
714 % {Use new cmd \cs{@addtofilelist}}
715 % Now define |\InputIfFileExists| to input |#1| if it seems to exist.
716 % Immediately prior to the input, |#2| is executed.
717 % If the file |#1| does not exist, execute `|#3|'.
718 % \changes{v1.0t}{1995/05/25}
719 % {(CAR) added \cs{long}}
721 \long\def \InputIfFileExists#1#2{%
723 {#2\@addtofilelist{#1}\@@input \@filef@und}}
727 % \begin{macro}{\input}
728 % Input a file: if the argument is given in braces use safe input
729 % macros, otherwise use \TeX's primitive |\input| command (which is
730 % called |\@@input| in \LaTeX).
731 % \changes{v0.9b}{1993/12/04}{Macro reimplemented}
733 \def\input{\@ifnextchar\bgroup\@iinput\@@input}
737 % \begin{macro}{\@iinput}
738 % Define |\@iinput| (i.e., |\input|) in terms of
739 % |\InputIfIfileExists|.
740 % \changes{v0.9b}{1993/12/04}{Macro reimplemented}
743 \InputIfFileExists{#1}{}%
744 {\filename@parse{#1}%
745 \edef\reserved@a{\noexpand\@missingfileerror
746 {\filename@area\filename@base}%
747 {\ifx\filename@ext\relax tex\else\filename@ext\fi}}%
752 % \begin{macro}{\@input}
753 % \changes{v0.9b}{1993/12/04}{Macro reimplemented}
754 % \changes{v0.9p}{1994/01/18}%
755 % {do not use a different definition for \cs{input@path}}
756 % Define |\@input| in terms of |\IfIfileExists|.
757 % So this is a `safe input' command, but the files input are not
758 % listed by |\listfiles|.
760 % We don't want |.aux|, |.toc| files etc be listed by |\listfiles|.
761 % However, something like |.bbl| probably should be listed and thus
762 % should be implemented not by |\@input|.
765 \IfFileExists{#1}{\@@input\@filef@und}{\typeout{No file #1.}}}
769 % \begin{macro}{\@input@}
770 % \changes{v0.9p}{1994/01/18}{Macro added}
771 % \task{???}{share code with `@input ?}
772 % Version of |\@input| that does add the file to |\@filelist|.
774 \def\@input@#1{\InputIfFileExists{#1}{}{\typeout{No file #1.}}}
778 % \begin{macro}{\@missingfileerror}
779 % This `error' command avoids \TeX's primitive missing file loop.
781 % Missing file error. Prompt for a new filename, offering a default
783 % \changes{LaTeX2e}{1993/11/21}
784 % {Stop infinite looping on \cs{@er@ext}}
785 % \changes{LaTeX2e}{1993/11/28}
786 % {Use filename parser from dircheck}
787 % \changes{LaTeX2e}{1994/03/15}
788 % {Quit on x or X just like a real error}
789 % \changes{LaTeX2e}{1994/05/26}
790 % {Modify message format}
791 % \changes{v1.0j}{1994/11/03}
792 % {Move here from ltclass}
793 % \changes{v1.0w}{1995/10/06}
796 \gdef\@missingfileerror#1#2{%
797 \typeout{^^J! LaTeX Error: File `#1.#2' not found.^^J^^J%
798 Type X to quit or <RETURN> to proceed,^^J%
799 or enter new name. (Default extension: #2)^^J}%
800 \message{Enter file name: }%
802 \global\read\m@ne to\@gtempa}%
805 \def\reserved@a{x}\ifx\reserved@a\@gtempa\batchmode\@@end\fi
806 \def\reserved@a{X}\ifx\reserved@a\@gtempa\batchmode\@@end\fi
807 \filename@parse\@gtempa
809 \ifx\filename@ext\relax#2\else\filename@ext\fi}%
811 \noexpand\InputIfFileExists
812 {\filename@area\filename@base.\filename@ext}%
814 {\noexpand\@missingfileerror
815 {\filename@area\filename@base}{\filename@ext}}}%
821 % \begin{macro}{\@obsoletefile}
822 % For compatibility with \LaTeX~2.09 document styles, we distribute
823 % files called |article.sty|, |book.sty|, |report.sty|,
824 % |slides.sty| and |letter.sty|. These use the command
825 % |\@obsoletefile|, which produces a warning message.
826 % \changes{v0.9m}{1993/12/20}{Added this command, removed
828 % \changes{v1.0f}{1994/05/02}{Make \cs{@onlypreamble}}
830 \def\@obsoletefile#1#2{%
831 \@latex@warning@no@line{inputting `#1' instead of obsolete `#2'}}
832 \@onlypreamble\@obsoletefile
835 % \subsection{Listing files}
837 % \begin{macro}{\@filelist}
838 % A list of files input so far. The initial value of |\@gobble| eats
839 % the comma before the first file name.
841 \let\@filelist\@gobble
845 % \begin{macro}{\@addtofilelist}
846 % Add to the list of files input so far.
847 % \changes{LaTeX2e}{1994/03/13}
849 % \changes{LaTeX2e}{1995/10/01}
851 % This `real' definition is only used for `cfg' files during initex.
852 % An initial definition of |\@gobble| has already been set.
854 %\def\@addtofilelist#1{\xdef\@filelist{\@filelist,#1}}
858 % \begin{macro}{\listfiles}
859 % A preamble command to cause |\end{document}| to list files input
860 % from the main file.
861 % \changes{LaTeX2e}{1993/11/22}
862 % {Removed checking for \cs{@unknownversion}}
863 % \changes{LaTeX2e}{1994/01/17}
864 % {New Version, adds `.tex' if needed, and lines up columns}
865 % \changes{LaTeX2e}{1994/05/13}
866 % {Stop \cs{listfiles} being run twice}
867 % \changes{v1.0i}{1994/10/18}
868 % {code moved here from ltclass}
872 \def\@listfiles##1##2##3##4##5##6##7##8##9\@@{%
874 \@tfor\reserved@c:=##1##2##3##4##5##6##7##8\do{%
875 \ifx\reserved@c\reserved@d
876 \edef\filename@area{ \filename@area}%
880 % \changes{v1.0o}{1994/11/30}
881 % {Use \cs{@dofilelist}}
884 \typeout{^^J *File List*}%
885 \@for\@currname:=\@filelist\do{%
886 \filename@parse\@currname
889 \ifx\filename@ext\relax tex\else\filename@ext\fi}%
890 \expandafter\let\expandafter\reserved@b
891 \csname ver@\reserved@a\endcsname
892 \expandafter\expandafter\expandafter\@listfiles\expandafter
893 \filename@area\filename@base\\\\\\\\\\\\\\\\\\\@@
895 \filename@area\reserved@a
896 \ifx\reserved@b\relax\else\@spaces\reserved@b\fi}}%
897 \typeout{ ***********^^J}}}
900 % \changes{LaTeX2e}{1994/03/13}
901 % {Reset \cs{@addtofilelist} at begin document}
902 % \changes{LaTeX2e}{1994/03/16}
903 % {Move this code directly into \cs{document}}
904 % The |\@filelist| will be de-activated if |\listfiles| does not
905 % appear in the preamble. |\begin{document}| contains code equivalent
909 % \ifx\@listfiles\@undefined
910 % \let\@filelist\relax
911 % \let\@addtofilelist\@gobble
915 \@onlypreamble\listfiles
919 % \begin{macro}{\@dofilelist}
920 % \changes{v1.0o}{1994/11/30}
923 \let\@dofilelist\relax