diff options
author | Karl Berry <karl@freefriends.org> | 2012-03-26 23:18:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-03-26 23:18:55 +0000 |
commit | be6233465c6f7578e79a4471d725b79bf0678996 (patch) | |
tree | a28ca07c872b1b4f5198a5cd58a9510db50fd2c0 /Master/texmf-dist/tex/latex | |
parent | 0e7c4deae1d24a03668f9705a75bbf8ffa2c4849 (diff) |
new latex package nicefilelist (26mar12)
git-svn-id: svn://tug.org/texlive/trunk@25746 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/nicefilelist/nicefilelist.sty | 210 |
1 files changed, 210 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/nicefilelist/nicefilelist.sty b/Master/texmf-dist/tex/latex/nicefilelist/nicefilelist.sty new file mode 100644 index 00000000000..79d3ad0fafd --- /dev/null +++ b/Master/texmf-dist/tex/latex/nicefilelist/nicefilelist.sty @@ -0,0 +1,210 @@ +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesPackage{nicefilelist}[2012/03/23 v0.1 + 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 *} +%% +%% === 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@'...?): + \let\@listfiles\relax +%% |\@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}}% + \@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 + \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 + \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}% + \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 + \fi + }% + }% +%% The line of stars: + \typeout{ \space\space\space + \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@<file>\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 + \fi +% \typein{code of ##1 is \number`##1.}% + \if@tempswa + \expandafter\expandafter\expandafter \NFL@test@digit + \else + \expandafter\expandafter\expandafter\NFL@kill + \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. +%% \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}}% +} +%% === 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 |