From 9fc033895f0466fc3ad09b515d588d61ea42f960 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 29 Mar 2012 23:18:41 +0000 Subject: nicefilelist (29mar12) git-svn-id: svn://tug.org/texlive/trunk@25778 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/nicefilelist/README | 4 +- .../texmf-dist/doc/latex/nicefilelist/SrcFILEs.txt | 8 +- .../doc/latex/nicefilelist/nicefilelist.pdf | Bin 320905 -> 338631 bytes .../tex/latex/nicefilelist/nicefilelist.sty | 272 +++++++++++++-------- 4 files changed, 171 insertions(+), 113 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/nicefilelist/README b/Master/texmf-dist/doc/latex/nicefilelist/README index e24f80cddb8..8629b2ff796 100644 --- a/Master/texmf-dist/doc/latex/nicefilelist/README +++ b/Master/texmf-dist/doc/latex/nicefilelist/README @@ -1,12 +1,12 @@ README for the `nicefilelist' package "\listfiles Alignment for Connoisseurs" - (C) Uwe Lueck 2012/03/23 + (C) Uwe Lueck 2012/03/27 While `longnamefilelist.sty' improves LaTeX's \listfiles with respect to long base filenames only, the present `nicefilelist.sty' -'nicefilelist.sty' can keep separate columns for +can keep separate columns for (i) date (ii) version, and (iii) "caption" (don't write caption text in date column), their alignment not being disturbed by short filename extensions diff --git a/Master/texmf-dist/doc/latex/nicefilelist/SrcFILEs.txt b/Master/texmf-dist/doc/latex/nicefilelist/SrcFILEs.txt index 59eceb0667d..b1d99b8fade 100644 --- a/Master/texmf-dist/doc/latex/nicefilelist/SrcFILEs.txt +++ b/Master/texmf-dist/doc/latex/nicefilelist/SrcFILEs.txt @@ -1,16 +1,16 @@ *File List* -nicefilelist.sty 2012/03/23 v0.1 more file list alignment (UL) - monofill.sty 2012/03/19 v0.1a monospace alignment (UL) +nicefilelist.sty 2012/03/29 v0.2 more file list alignment (UL) + monofill.sty 2012/03/29 v0.1a monospace alignment (UL) myfilist.sty 2011/01/30 v0.3a \listfiles -- mine only (UL) readprov.sty 2010/11/27 v0.3 file infos without loading (UL) nicefilelist.tex 2012/03/23 -- documenting nicefilelist.sty - provonly.fd -- -- -- -- such + provonly.fd -- -- -- -- such wrong.prv * NOT FOUND * empty.f * NOT FOUND * srcfiles.tex 2012/03/23 -- file infos -> SrcFILEs.txt *********** - List made at 2012/03/23, 10:31 + List made at 2012/03/29, 11:08 from script file srcfiles.tex diff --git a/Master/texmf-dist/doc/latex/nicefilelist/nicefilelist.pdf b/Master/texmf-dist/doc/latex/nicefilelist/nicefilelist.pdf index f786a029384..fbd3c8ce4b0 100644 Binary files a/Master/texmf-dist/doc/latex/nicefilelist/nicefilelist.pdf and b/Master/texmf-dist/doc/latex/nicefilelist/nicefilelist.pdf differ diff --git a/Master/texmf-dist/tex/latex/nicefilelist/nicefilelist.sty b/Master/texmf-dist/tex/latex/nicefilelist/nicefilelist.sty index 79d3ad0fafd..9b28578966e 100644 --- a/Master/texmf-dist/tex/latex/nicefilelist/nicefilelist.sty +++ b/Master/texmf-dist/tex/latex/nicefilelist/nicefilelist.sty @@ -1,5 +1,5 @@ \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{nicefilelist}[2012/03/23 v0.1 +\ProvidesPackage{nicefilelist}[2012/03/29 v0.2 more file list alignment (UL)] %% Copyright (C) 2012 Uwe Lueck, @@ -61,143 +61,193 @@ %% \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'". +%% %% === 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\ requires that `\@listfiles' -%% is defined, although we don't use it -%% (TODO use it in place of some `\NFL@'...?): +%% ---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@'...?) +%% \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 \space\space - \MFrightinfield{*File List*}{f-base}}% + \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}% - \expandafter\let\expandafter\NFL@ver +%% Like \LaTeX's &\reserved@b: + \expandafter\let\expandafter\@tempb \csname ver@\filename@base.\filename@ext\endcsname -%% Some assignments for parsing file info, resembling \LaTeX's -%% `\GetFileInfo', to make life within `\typout{}' easier: - \ifx\NFL@ver\relax \else -%% We assume that no date is given, until we find it; -%% likewise for version: - \let\NFL@date \NFLnodate - \let\NFL@version\NFLnoversion - \ifx\NFL@ver\@empty \else - \ifx\NFL@ver\space -% \let\NFL@ver\@empty - \else -%% `\NFL@words' aims to be more careful than \LaTeX's `\GetFileInfo': - \expandafter \NFL@words \NFL@ver - \@gobble? \@gobble? \@gobble?\@gobble?% -%% \cs{filedate} is not empty at the present condition, -%% let's see if it starts with a date: - \expandafter\NFL@test@date\filedate -%% Dummies in case \cs{filedate} has less elements than -%% \cs{NFL@test@date} tries to read: - \@empty\@empty\@empty\@empty\@empty - \@empty\@empty\@empty\@empty - \@nil - \if@tempswa - \let\NFL@date\filedate -%% Is \cs{fileversion} a version id? - \ifx\fileversion\@empty \else - \expandafter\NFL@test@version\fileversion\@empty\@nil - \fi -%% Otherwise, the first word could be a version number---we -%% ignore such awkward files in this package version (TODO) -%% and even assume that no version is indicated. -% \else - \fi - \fi - \fi -%% When \cs{filedate} is not a file date, it is considered part of -%% the file ``caption," likewise for version: - \edef\fileinfo{% - \ifx\NFL@date\NFLnodate \filedate \space \fi - \ifx\NFL@version\NFLnoversion \fileversion \space \fi - \fileinfo}% - \fi +%% 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\filename@base{f-base}.% - \NFL@make@macro@arg\MFleftinfield \filename@ext {f-ext}% + \NFL@make@macro@arg\MFrightinfield\@tempa {f-base}.% + \NFL@make@macro@arg\MFleftinfield \filename@ext{f-ext}% \NFLspaceI - \ifx\NFL@ver\relax - \NFLnotfound - \else - \NFL@date - \NFLspaceII %% TODO conditionally? - \NFL@make@macro@arg\MFleftinfield\NFL@version {f-version}% - \NFLspaceIII %% TODO conditionally? - \fileinfo + \ifx\@tempb\relax + \NFLnotfound + \else + \NFL@make@macro@arg\NFL@space@split\@tempb + \NFL@maybe@three + \NFL@date@or@rest +%% TODO `\expandafter's? \fi }% }% %% The line of stars: - \typeout{ \space\space\space - \MFrightinfield{***********}{f-base}^^J}% + \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@words| tries to get the first three ``words": - \def\NFL@words##1 ##2 ##3\@gobble?{% - \edef\filedate{##1}\edef\fileversion{##2}\edef\fileinfo{##3}% -%% When the result of ```\csname ver@\endcsname'" -%% contains a single space token only, -%% \cs{fileinfo} contains the result of expanding ```\@gobble? '", -%% as opposed to ```\@gobble?"' in other cases. Thus this ``normalization": - \ifx\fileinfo\space \let\fileinfo\@empty \fi }% -%% |\NFL@test@date| checks whether the first ``word" is a date: - \def\NFL@test@date##1##2##3##4##5##6##7##8##9{% - \@tempswatrue -%% Are there slashes at the correct positions? - \if/##5\else\@tempswafalse\fi - \if/##8\else\@tempswafalse\fi -%% Now we test the eight positions of expected digits: - \NFL@test@digits{##1##2##3##4##6##7##9}}% - \def\NFL@test@digits##1##2##3\@nil{% -%% It's not a date if it has more than 10 characters (TODO?). -%% If it \emph{is} a date, #2 is the last digit, -%% and #3 contains the dummies, and then? - \edef\@tempa{##3}% -% \typein{##1}% - \ifx\@tempa\@empty \NFL@test@digit ##1##2\@nnil - \else \@tempswafalse \fi }% - \def\NFL@test@digit##1{% - \ifx##1\@nnil \else - \ifnum`##1<48 \@tempswafalse - \else \ifnum`##1>57 \@tempswafalse \fi +%% % The definitions of macros called from `\@dofilelist' are following. +%% \[|\NFL@make@macro@arg|\] results in +%% `{}' where is the one-step expansion of +%% : + \def\NFL@make@macro@arg##1##2{\expandafter##1\expandafter{##2}}% +%% |\NFL@space@split{}{}{}| +%% passes prefix and suffix as arguments to +%% if a space token is within , otherwise +%% gets the original as single +%% argument:\footnote{The latter is useful here where +%% becomes visible only by an &\expandafter.} + \def\NFL@space@split##1{% + \NFL@return@space@split##1\@nil: \NFL@criterion\@nil\@nil@{##1}}% + \def\NFL@return@space@split##1 ##2\@nil##3\@nil@##4##5##6{% + \ifx\NFL@criterion##2\expandafter\@secondoftwo +%% If #2 is empty, \cs{ifx} fails, comparing &\NFL@criterion with +%% &\expandafter. This only happens when the space is the last thing +%% in . %% 2012/03/27 + \else \expandafter\@firstoftwo \fi + {##5{##1}{##2}}{##6{##4}}}% +%% Dealing with |\NFL@date@or@rest{}| before `\NFL@maybe@three': + \def\NFL@date@or@rest##1{% + \NFL@if@date{##1}{##1}{\NFL@no@date@version##1}}% +%% |\NFL@if@date{}{}{}| ... + \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{% + \ifx##5/% + \ifx##8/% + \NFL@xpxpxp \NFL@ten@only + \else + \expandafter\NFL@after@false \fi -% \typein{code of ##1 is \number`##1.}% - \if@tempswa - \expandafter\expandafter\expandafter \NFL@test@digit - \else - \expandafter\expandafter\expandafter\NFL@kill + \else + \NFL@after@false +%% This especially happens when is empty. + \fi +%% Digit candidates back: + {##1##2##3##4##6##7}}% + \def\NFL@xpxpxp{\expandafter\expandafter\expandafter}% +%% If the word is a date, we now have taken 6 of the 8 digits. +%% \[|\NFL@ten@only{}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{% + \ifx\NFL@xi##4% + \expandafter\NFL@digits + \else + \NFL@after@false + \fi +%% Finally checking digits: + ##1##2##3\@nnil}% +%% |\NFL@digits| is a loop through single tokens: + \def\NFL@digits##1{% + \ifx##1\@nnil + \expandafter \NFL@true + \else + \ifnum`##1<`0 + \expandafter \NFL@after@false + \else + \ifnum`##1>`9 + \NFL@xpxpxp \NFL@after@false + \else + \expandafter\NFL@xpxpxp\expandafter \NFL@digits + \fi \fi \fi }% - \def\NFL@kill##1\@nnil{}% -%% TODO or use \ctanpkgref{coolstr}? -%% or there may be \emph{some} package that offers a test -%% whether something is a date. +%% |\NFL@after@false| calls `\NFL@false' \emph{after} closing one +%% conditional: + \def\NFL@after@false{\expandafter\NFL@false}% +%% |\NFL@false| skips further candidates and dummies and chooses : + \def\NFL@false##1\@nil{\@secondoftwo}% +%% |\NFL@true| skips further candidates and dummies and chooses : + \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{}{}| looks whether +%% is a date. If it is, it is written to screen, and then we look +%% if contains a version id. Otherwise ```_'" +%% 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{}|: + \def\NFL@version@or@rest##1{% + \NFL@if@version{##1}% + {\NFL@place@version{##1}}% + {\NFLnoversion@\NFLspaceIII##1}}% +%% |\NFL@if@version{}{}{}|: + \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@test@version| checks whether the second ``word" is a version id: - \def\NFL@test@version##1##2##3\@nil{% - \if v##1\NFL@test@digit##2\@nnil \else \@tempswafalse \fi - \if@tempswa \let\NFL@version\fileversion \fi - }% -%% |\NFL@make@macro@arg| expands a macro storing a list inside braces -%% (perhaps 'monofill' should offer such a thing TODO): - \def\NFL@make@macro@arg##1##2{\expandafter##1\expandafter{##2}}% +%% |\NFL@v@digit{}{}{}| checks whether the first thing +%% is a `v' and the second a digit: + \def\NFL@v@digit##1##2##3\@nil{% + \ifx##1v% + \expandafter \NFL@digits \expandafter ##2\expandafter \@nnil + \else + \NFL@after@false + \fi + \@nil}% +%% |\NFL@place@version{}| adds filler to version id: + \def\NFL@place@version##1{\MFleftinfield{##1}{f-version}}% +%% |\NFL@maybe@version@rest{}{}|: + \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 @@ -208,3 +258,11 @@ 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 -- cgit v1.2.3