summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fileinfo/myfilist.sty
blob: d6f59020e8a6bbfac4db98bc1b62b9cfcd44296b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
\def \filename {myfilist.sty} %% macro package for LaTeX, 

%% modifies \listfiles to choose files to be listed and 
%% list them in a chosen file. 

\def \fileversion {0.3a}    \def \filedate {2011/01/30} 

%% copyright (C) 2008, 2010, 2011 Uwe Lueck, 
%% http://www.contact-ednotes.sty.de.vu 
%% -- author-maintained in the sense of LPPL below.
%%
%% This file can be redistributed and/or modified under 
%% the terms of the LaTeX Project Public License; either 
%% version 1.3a of the License, or any later version.
%% The latest version of this license is in
%%     http://www.latex-project.org/lppl.txt
%% We did our best to help you, but there is NO WARRANTY. 
%%
%% Please report bugs, problems, and suggestions via 
%% 
%%   http://www.contact-ednotes.sty.de.vu 
%%
% USAGE:
% 
% Write a script file like gather.tex which you should have received 
% together with myfilist.sty. We use LaTeX2e (required!), yet (in 
% general) not for typesetting a document, therefore the script file 
% needn't contain \documentclass. myfilist.sty is loaded by 
% 
%     \RequirePackage{myfilist}
% 
% instead of \usepackage{myfilist}. Usually you don't want to have 
% myfilist.sty in the list, so type 
%
%     \EmptyFileList 
%
% next; or type it after some additional \RequirePackage... for 
% packages you want to use but not list. 
%
% Next list the names of the files 
% whose informations you want to get as arguments of 
%
%     \ReadFileInfos  or  \ReadPackageInfos  or  \ReadClassInfo
%
% With the latter two, you can omit ".sty" or ".cls" as with 
% \usepackage and \documentclass. With the first one, the file name 
% extension ".tex" may be omitted. The two first commands accept lists 
% with commas as separators almost like with \usepackage (currently we 
% must use "%" to hide a line break in the script, and there must be 
% no spaces in the list).---For more details on these commands, 
% please see readprov.pdf.
% 
% The list of files is actually printed in the transcript .log 
% and on screen on
%
%     \ListInfos
%
% The list can additionally be written into a plain text file, 
% 
%     \ListInfos[filelist.txt]
%
% as an example; i.e., you can use the brackets to tell which file is 
% to contain your list of files. The file informations appear in the 
% order of their names in your script file. 
% 
% \ListInfos concludes, ends the job, anything following in the 
% script file will be ignored.---All of this requires %% 2010/04/02
% that you run gather.tex or your other script file, about as
%
%     latex gather
%
% To list files that were loaded earlier in a different order, 
% list them in an \emph{optional argument} of \EmptyFileList, e.g.,
% % trick avoiding main replacement 2010/11/26:
%
%     \EmptyFileList[myfilist-.sty,readprov-.sty]
%
% NOTE: myfilist.sty (in its present state) is unable to list files 
% that don't contain \ProvidesPackage, \ProvidesClass, or 
% \ProvidesFile. myfilist.sty "loads" files to extract version 
% informations, but quits them as soon as it has found one of these
% LaTeX2e commands. 
%
% IMPLEMENTATION: 

\NeedsTeXFormat{LaTeX2e}[1994/12/01] %% \newcommand* etc. 
\ProvidesPackage{myfilist}
                [\filedate\space v\fileversion \space 
                 \string\listfiles\space-- mine only (UL)] 
% 
% |\ReadFileInfos|, |\ReadPackageInfos|, and |\ReadClassInfo|
% are implemented in readprov.sty:
\RequirePackage{readprov}[2010/11/26]
% 
% |\EmptyFileList[<read-again-files>]| %% opt. arg. 2010/11/26
\newcommand{\EmptyFileList}[1][]{%
  \let\@filelist\@gobble
  \@for\@tempa:=#1\do{%
    \global \expandafter \let \csname ver@\@tempa\endcsname \relax}} 
% |\ListInfos[<external output file>]|
\newcommand*{\ListInfos}[1][]{%
  \ifx$#1$\@dofilelist\else
    \newwrite\file@of@filelist
    \immediate\openout\file@of@filelist=#1\relax
    \def\typeout##1{%
      \read@@typeout{##1}%
      \immediate\write\file@of@filelist{##1}}%
    \@dofilelist
    %% made at: 
    \@tempcnta\time      \@tempcntb\@tempcnta 
    \divide\@tempcnta 60 \count@\@tempcnta 
    \multiply\count@ 60  \advance\@tempcntb -\count@ 
    \typeout{ List made at
      \the\year/\two@digits{\the\month}/\two@digits{\the\day},
      \two@digits{\the\@tempcnta}:\two@digits{\the\@tempcntb}^^J
      from script file \jobname.tex^^J}%% TODO ".tex"!? 2008/03/19
    \immediate\closeout\file@of@filelist
  \fi
  \stop}
  %% <- TODO how to suppress first empty line? 2008/03/16
  %% -> TODO more general style of output file 2008/03/19
\let\read@@typeout\typeout
\listfiles

\endinput 

%% VERSION HISTORY
v0.1    2008/03/19  created file "readprov.sty"
        2008/03/23  smart file name separation, \ifx$ for \ifcat$
        2008/05/22  typo ist -> it
v0.2    2010/04/03  renamed "myfiles.sty"; 
                    broke long lines etc. for doc
SENT TO CTAN -- declined
v0.2a   2010/04/08  undoubled \NeedsTeXFormat, copyright updated
v0.3    2010/11/26  split off from "myfiles.sty", opt. arg. for 
                    \EmptyFileList, doc. reworked
        2010/11/27  some USAGE clarifications
v0.3a   2011/01/29  two empty lines commented out
        2011/01/30  copyright updated