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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{nicefilelist}[2012/05/20 v0.4
more file list alignment (UL)]
%% Copyright (C) 2012 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.3c 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
%%
%% === Alignment Settings ===
%% \label{sec:templates}
%% We use the \ctanpkgref{monofill} package for alignment of plain text:
\RequirePackage{monofill}
%% See its documentation for details.
%%
%% We support three alignment ``fields" according to the terminology of \pkg{monofill}.
%% Their ids are |f-base| for base filenames, |f-ext| for filename extensions,
%% % |f-date| for the revision date,
%% and |f-version| for the revision version id of a file %%% ,
%% % the latter two
%% as read from `\ProvidesFile', `\ProvidesPackage',
%% or `\ProvidesClass' command in the file.
%% Initial settings for them are following.
%% For modifying them, load 'nicefilelist.sty',
%% then type your own settings, then issue `\listfiles'
%% or load 'myfilist.sty'.
\MFfieldtemplate{f-base}{nicefilelist}
\MFfieldtemplate{f-ext}{tex}
\MFfieldtemplate{f-version}{v0.11a}
%% We are not supporting version numbers greater than 9 at present---sorry! (TODO)
%%
%% |\NFLspaceI|, |\NFLspaceII|, and |\NFLspaceIII|
%% determine the space between the four
%% columns for names, dates, versions, and ``captions":
\newcommand*{\NFLspaceI} { \space}
\newcommand*{\NFLspaceII} { \space}
\newcommand*{\NFLspaceIII}{ }
%%
%% === Failure Displays ===
%% \label{sec:failure}
%% |\NFLnodate| is displayed in place of a file date if it seems
%% not to be given (configurable):
\newcommand*{\NFLnodate}{ -- \space-- --}
%% |\NFLnoversion| likewise---however, for alignment,
%% each wanted space must be specified as `\space'
%% (not just a code blank space).
%% It may need adjustment (by `\renewcommand') when
%% `\MFfieldtemplate{f-version}' is modified:
\newcommand*{\NFLnoversion}{\space--}
%% |\NFLnotfound| is for files with wrong or no
%% \cs{Provides.\empty..} command:
\newcommand*{\NFLnotfound}{ * NOT FOUND *}
%%
%% === Safe Tests ===
%% \label{sec:safe}
%% For fairly safe tests, we brief{}ly use an exotic version of `Q'
%% (similarly to \ctanpkgref{ifmptarg}):
\catcode`\Q=7 \let\NFL@criterion=Q \catcode`\Q=11
%% %% 2012/03/27:
%% It appears to me that expandable tests like the ones employed here
%% never are perfectly safe; you only can say that it is safe with a
%% source meeting certain conditions. \ctanpkgref{fifinddo} originally
%% was made for ``plain text," to be read from files without assigning
%% \TeX's special category codes. \emph{Here} we assume that the source
%% (text in \cs{Provides.\empty..} arguments) will never contain such a
%% ``funny `Q'".
%%
%% === Package Option `[r]' ===
%% \label{sec:opt}
%% v0.4 offers package option `[r]' that allows strings with `r'
%% in place of `v', for ``release." `\NFL@v@digit''s definition
%% therefore depends ... we use |\@listfiles| for a ``message"
%% there. For the original restricted functionality, it expands
%% to |\NFL@false|.
\def\@listfiles{\noexpand\NFL@false}
%% Package option `[r]' carries out another test instead.
%% See the accompanying file `SrcFILEs.txt' to see the effect.
%% TODO: update example!?
\DeclareOption{r}{%
\def\@listfiles{%
{\noexpand\NFL@ifx@kbl##1r%
{\noexpand\NFL@digits##2\noexpand\@nnil}%
\noexpand\NFL@false}%
}%
}
\ProcessOptions
%%
%% === Redefining \cs{listfiles} ===
%% Similarly to original \LaTeX, |\listfiles| carries almost everything
%% that is needed for the file list only:
\renewcommand*{\listfiles}{%
\let\listfiles\relax
%% ---this clears memory. Now \LaTeX\ doesn't collect file names for
%% &\listfiles when &\@listfiles is undefined, therefore
% \let\@listfiles\relax
%% % although we don't use it.
%% % (TODO use it in place of some `\NFL@'...?)
%% ... postponed for v0.4 ...
%% \vskip\smallskipamount\noindent
%% |\@dofilelist| is executed by the standard \LaTeX\ `\enddocument'
%% macro or by `\ListInfos' from the \ctanpkgref{myfilist} package.
\def\@dofilelist{%
%% ``Title:"
\typeout{^^J %% trick 2012/03/29 vv
\MFrightinfield{*File Lis}{f-base}t*}%
\@for\@currname:=\@filelist\do{%
%% This starts the loop through the list of files
\filename@parse\@currname
\edef\filename@ext{%
\ifx\filename@ext\relax tex\else\filename@ext\fi}%
%% Like \LaTeX's &\reserved@b:
\expandafter\let\expandafter\@tempb
\csname ver@\filename@base.\filename@ext\endcsname
%% According to `source2e.pdf', &\filename@area may be a directory.
%% Trying support of this is seems to be a new feature with v0.2---not
%% tested, TODO!
\edef\@tempa{\filename@area\filename@base}%
%% Actually I would like to be able to do even the filename parsing
%% expandably---for all systems, `texsys.cfg'!?? TODO
\typeout{%
%% Now all parsing and checking must be expandable.
\NFL@make@macro@arg\MFrightinfield\@tempa {f-base}.%
\NFL@make@macro@arg\MFleftinfield \filename@ext{f-ext}%
\NFLspaceI
\NFL@ifx@kbl\@tempb\relax\NFLnotfound{%
\NFL@make@macro@arg\NFL@space@split\@tempb
\NFL@maybe@three
\NFL@date@or@rest
}%
}%
}%
%% The line of stars:
\typeout{ %% trick vvv 2012/03/29
\MFrightinfield{********}{f-base}***^^J}%
%% TODO or more stars as with 'longnamefilelist'?
}%
%% This finishes the definition of `\@dofilelist'.
%% % The definitions of macros called from `\@dofilelist' are following.
%% \[|\NFL@make@macro@arg<cmd-1><cmd-2>|\] results in
%% `<cmd-1>{<t-list>}' where <t-list> is the one-step expansion of
%% <cmd-2>:
\def\NFL@make@macro@arg##1##2{\expandafter##1\expandafter{##2}}%
%% |\NFL@space@split{<token-list>}{<spaced>}{<unspaced>}|
%% passes prefix and suffix as arguments to <spaced>
%% if a space token is within <token-list>, otherwise
%% <unspaced> gets the original <token-list> as single
%% argument. The latter is useful here where <token-list>
%% becomes visible only by an &\expandafter.
%% The following construction is discussed more generally
%% in the \ctanpkgref{bitelist} package.
\def\NFL@space@split##1{%
\NFL@return@space@split##1\@nil: \NFL@criterion\@nil\@nil@{##1}}%
%% `\NFL@return@spaces@split' essentially has \emph{three} parameters
%% delimited by ` ', `\@nil', and `\@nil' again.
\def\NFL@return@space@split##1 ##2\@nil##3\@nil@##4##5##6{%
\NFL@ifx@kbl\NFL@criterion{##2}%
%% If #2 is empty, `\NFL@ifx@kbl' (as of v0.3) compares
%% `\NFL@criterion' (criterion indicating ``unspaced") with
%% `\expandafter'. This only happens when the space is the last thing
%% in <token-list>, and `<spaced>' is chosen correctly.
{##6{##4}}{##5{##1}{##2}}}%
%% |\NFL@ifx@kbl{<token>}{<maybe-token>}{<ifx>}{<unlessx>}|
%% as of v0.3 should save some tokens, in some longer run,
%% especially if we want to add nestings---cf. \file{source2e.pdf}
%% for ``Kabelschacht."
\def\NFL@ifx@kbl##1##2{%
\ifx##1##2\expandafter \@firstoftwo
\else \expandafter \@secondoftwo \fi}%
%% Dealing with |\NFL@date@or@rest{<token-list>}| before `\NFL@maybe@three':
\def\NFL@date@or@rest##1{%
\NFL@if@date{##1}{##1}{\NFL@no@date@version##1}}%
%% |\NFL@if@date{<token-list>}{<yes>}{<no>}| ...
\def\NFL@if@date##1{\NFL@slashes##1\NFL@xi xyzxyzxyzx\@nil}%
%% |\NFL@slashes| checks that there are slashes at the expected places:
\def\NFL@slashes##1##2##3##4##5##6##7##8{%
\NFL@ifx@kbl##5/%
{\NFL@ifx@kbl##8/\NFL@ten@only\NFL@false}%
\NFL@false
%% This especially happens when <token-list> is empty.
%% Digit candidates back:
{##1##2##3##4##6##7}}%
%% If the word is a date, we now have taken 6 of the 8 digits.
%% \[|\NFL@ten@only{<digits>}<digit><digit>Q|\]
%% takes the two remaining and then a thing that should be `Q'
%% in the funny sense of Sec.~\ref{sec:safe}.
\def\NFL@ten@only##1##2##3##4{%
\NFL@ifx@kbl\NFL@xi##4\NFL@digits\NFL@false
%% Finally checking digits:
##1##2##3\@nnil}%
%% |\NFL@digits<token>| is a loop through single tokens:
\def\NFL@digits##1{%
\NFL@ifx@kbl##1\@nnil\NFL@true{%
\NFL@if@digit@code##1<0\NFL@false{%
\NFL@if@digit@code##1>9\NFL@false\NFL@digits
}%
}%
}%
%% |\NFL@if@digit@code<char-1><relation><char-2><fits><bad>|:
\def\NFL@if@digit@code##1##2##3{%
\ifnum`##1##2`##3 \expandafter \@firstoftwo
\else \expandafter \@secondoftwo \fi}%
%% |\NFL@false| skips further candidates and dummies and chooses <no>:
\def\NFL@false##1\@nil{\@secondoftwo}%
%% |\NFL@true| skips further candidates and dummies and chooses <yes>:
\def\NFL@true##1\@nil{\@firstoftwo}%
%% We don't support version without date, therefore run
%% |\NFL@no@date@version| as soon as we find that the file info
%% does not start with a date:
\def\NFL@no@date@version{%
\NFLnodate\NFLspaceII\NFLnoversion@\NFLspaceIII}%
%% |\NFLnoversion@| adds filler to &\NFLnoversion:
\def\NFLnoversion@{%
\NFL@make@macro@arg\NFL@place@version\NFLnoversion}%
%% |\NFL@maybe@three{<word-1>}{<rest>}| looks whether <word-1>
%% is a date. If it is, it is written to screen, and then we look
%% if <rest> contains a version id. Otherwise ```<word-1>_<rest>'"
%% is considered a ``caption" only.
\def\NFL@maybe@three##1##2{%
\NFL@if@date{##1}%
{##1\NFLspaceII
\NFL@space@split{##2}%
\NFL@maybe@version@rest
\NFL@version@or@rest}%
{\NFL@no@date@version##1 ##2}}%
%% |\NFL@version@or@rest{<token-list>}|:
\def\NFL@version@or@rest##1{%
\NFL@if@version{##1}%
{\NFL@place@version{##1}}%
{\NFLnoversion@\NFLspaceIII##1}}%
%% |\NFL@if@version{<token-list>}{<yes>}{<no>}|:
\def\NFL@if@version##1{\NFL@v@digit##1xy\@nil}%
%% TODO: At applications you see how some tokens could be saved.
%% On the other hand, the macros are more transparent in the
%% present way.
%% \vskip\smallskipamount\noindent
%% |\NFL@v@digit{<t1>}{<t2>}{<rest>}| checks whether the first thing
%% is a `v' and the second a digit---unless package option `[r]'
%% was chosen. v0.4 uses `\edef' for choosing:
\edef\NFL@v@digit##1##2##3\@nil{%
\noexpand\NFL@ifx@kbl##1v%
{\noexpand\NFL@digits##2\noexpand\@nnil}%
%% |\@listfiles| will either expand to the original `\NFL@false'
%% or to a test on `r':
\@listfiles
\noexpand\@nil}%
\let\@listfiles\relax
%% |\NFL@place@version{<token-list>}| adds filler to version id:
\def\NFL@place@version##1{\MFleftinfield{##1}{f-version}}%
%% |\NFL@maybe@version@rest{<list-1>}{<list-2>}|:
\def\NFL@maybe@version@rest##1##2{%
\NFL@if@version{##1}%
{\NFL@place@version{##1}\NFLspaceIII##2}%
{\NFLnoversion@\NFLspaceIII##1 ##2}}%
}
%% === Leaving the Package File ===
\endinput
%%
%% === VERSION HISTORY ===
v0.1 2012/03/20 started
2012/03/22 almost ready
2012/03/23 debugging; \NFLspaceI etc.;
documentation completed
v0.2 2012/03/24 file info processed by \typeout - start
2012/03/25 trying, debugging
2012/03/26 continued; \NFL@place@version, \NFLnoversion@;
works, reordered; another fix about Q -> \@empty
2012/03/27 undone the latter, explained; improved remarks on
\@listfiles
2012/03/29 alignment of title/stars with base<11
v0.30 2012/05/18f. \NFL@ifx@kbl in \NFL@return@space@split
2012/05/20 all \ifx reimplemented, old code kept
STORED INTERNALLY
v0.31 2012/05/20 removing old code - STORED INTERNALLY
v0.32 2012/05/20 removing \NFL@xpxpxp; replacing \NFL@after@false
by \NFL@ifnum@kbl, keeping old code
STORED INTERNALLY
v0.33 2012/05/20 removing old code; added 3 %s
STORED INTERNALLY
v0.4 2012/05/20 option [r]
|