summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fileinfo
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-11-28 23:51:04 +0000
committerKarl Berry <karl@freefriends.org>2010-11-28 23:51:04 +0000
commit41862aee3f93850e517e176a9c6879670e1ff68b (patch)
treeec8c17bb9e9111f46519e0d02ae44fff5aad7f50 /Master/texmf-dist/tex/latex/fileinfo
parent424ade50e036f3d865a1283f25173efa4e90bd37 (diff)
new latex package fileinfo (28nov10)
git-svn-id: svn://tug.org/texlive/trunk@20590 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/fileinfo')
-rw-r--r--Master/texmf-dist/tex/latex/fileinfo/myfilist.sty137
-rw-r--r--Master/texmf-dist/tex/latex/fileinfo/readprov.sty193
2 files changed, 330 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/fileinfo/myfilist.sty b/Master/texmf-dist/tex/latex/fileinfo/myfilist.sty
new file mode 100644
index 00000000000..2a8a976fa97
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/fileinfo/myfilist.sty
@@ -0,0 +1,137 @@
+\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.3} \def \filedate {2010/11/27}
+
+%% copyright (C) 2008, 2010 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
diff --git a/Master/texmf-dist/tex/latex/fileinfo/readprov.sty b/Master/texmf-dist/tex/latex/fileinfo/readprov.sty
new file mode 100644
index 00000000000..662ce7e13ef
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/fileinfo/readprov.sty
@@ -0,0 +1,193 @@
+%% readprov.sty
+%% --
+%% get file infos without reading the entire file
+
+\def \fileversion {0.3} \def \filedate {2010/11/27}
+
+%% copyright (C) 2008, 2010 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
+%%
+% USAGE:
+%
+% LOADING: The functionality of readprov.sty is activated by
+% \usepackage{readprov}
+% or
+% \RequirePackage{readprov}
+% (this one may precede \documentclass) in the document preamble.
+% 'readprov' does not have any package options.
+%
+% INSERTING: Recall that \\
+% %
+% |\GetFileInfo{<filename>}| (including extension)\\
+% %
+% from LaTeX's doc.sty sets macro \filename to <filename>
+% (including extension) and furthermore sets macros
+% \filedate, \fileversion, and \fileinfo
+% to the \emph{date}, \emph{version}, and further \emph{info}
+% associated with <filename> earlier ``some way'' ...
+% \ This means that file <filename> has been \input before
+% and identified itself by \ProvidesFile, \ProvidesPackage,
+% or \ProvidesClass.
+%
+% 'readprov' simply copies \GetFileInfo from doc.sty
+% so the same functionality is provided independently of
+% other doc.sty features---without loading LaTeX's doc.sty.
+%
+% % new 2010/11/27:
+% Unfortunately, \GetFileInfo is fragile, it is especially
+% unhelpful for referring to \emph{two} packages in the same
+% \thanks footnote. So we introduce (do compare 'zwgetfdate'!)\\
+% |\UseDateOf{<filename>}|\quad |\UseVersionOf{<filename>}|\quad
+% (with extension)\\
+% These commands are robust (even expandable). Instead of
+% $$\GetFileInfo{<filename>}\fileversion{}\texttt{ as of }\filedate$$
+% you can type
+% $$\UseFileVersionOf{<filename>}\texttt{ as of }\UseFileDateOf{<filename>}$$
+%
+% EXTRACTING: \GetFileInfo, \UseDateOf, and \UseVersionOf need the data
+% from \ProvidesPackage, \ProvidesClass, or \ProvidesFile.
+% Instead of getting them by \usepackage, \documentclass, or \input,
+% they can be obtained with the following commands.
+% \\
+% |\ReadFileInfos{<list-of-filenames>}| (with extensions)\\
+% applies to all kinds of files---provided such a file contains
+% such a \Provide... command.
+% \\
+% |\ReadPackageInfos{<list-of-filenames>}| (without extensions)\\
+% searches .sty files from <list-of-filenames> for \ProvidesPackage.
+%
+% The two former 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).
+% \\
+% |\ReadClassInfo{<filename>}| (without extension)\\
+% searches <filename>.cls for \ProvidesClass.
+% At present [TODO] it can be used once only,
+% and only for use with myfilist.sty.
+% But you can use \ReadFileInfos for reporting on \emph{various}
+% classes, even in a document!
+%
+% NOTE: (i)~So far, [TODO] the \Read... commands explained before
+% do not work after `\begin{document}'
+% (with rare exceptions, \NeedTeXFormat is one
+% obstacle---may be 'zwgetfdate' really is better).
+% (ii)~Those \Read... commands execute \GetFileInfo
+% (with the final file from the list). So you may be lucky to get
+% the intended \filename, \filedate, \fileversion, and \fileinfo
+% without using \GetFileInfo. The chance is the better the
+% later the \Read... command is used, best right before
+% `\begin{document}'. Even then it may *fail*---when the latter
+% command loads a package redefining \filedate etc. ...
+%
+% IMPLEMENTATION:
+
+\NeedsTeXFormat{LaTeX2e}[1994/12/01] %% \newcommand* etc.
+\ProvidesPackage{readprov}
+ [\filedate\space v\fileversion \space
+ file infos without loading (UL)]
+% INSERTING: \\
+% |\GetFileInfo{<filename>}| (with extension)\\ % \ %
+% just was stolen from Standard LaTeX's doc.sty
+% (before I varied it).
+% It is fragile.
+\def\GetFileInfo#1{%
+ \def\filename{#1}%
+ \def\@tempb##1 ##2 ##3\relax##4\relax{%
+ \def\filedate{##1}%
+ \def\fileversion{##2}%
+ \def\fileinfo{##3}}%
+% Here was:
+% \edef\@tempa{\csname ver@#1\endcsname}%
+% \expandafter\@tempb\@tempa\relax? ? \relax\relax}
+% We can do it a little more elegant with the internals
+% (that vary the original \GetFileInfo)
+% for our new \UseDateOf and \UseVersionOf:
+ \read@file@info\@tempb{#1}}
+% (Will be overwritten without warning
+% when doc.sty is loaded afterwards.)
+\newcommand*{\read@file@info}[2]{% new 2010/11/27
+ \expandafter \expandafter \expandafter
+ #1\csname ver@#2\endcsname \relax? ? \relax\relax}
+% |\UseDateof{<filename>}| is robust (expandable):
+\newcommand*{\UseDateOf}{\read@file@info\read@file@date}
+% The internal reading commands vary `\@tempb'
+% from the original \GetFileInfo:
+\def\read@file@date #1 #2\relax#3\relax{#1}
+% |\UseVersionOf{<filename>}| is robust (expandable) as well:
+\newcommand*{\UseVersionOf}{\read@file@info\read@file@version}
+\def\read@file@version#1 #2 #3\relax#4\relax{#2}
+% EXTRACTING: \\
+% |\ReadPackageInfos{<list-of-filenames>}| without extensions:
+\newcommand*{\ReadPackageInfos}{%
+ \read@package@infos\RequirePackage{sty}}
+% `\@pkgextension' and `\@clsextension' are bad
+% for using `\filename' in the document (`\@onlypreamble').
+% \\
+% |\ReadClassInfo{<filename>}| without extension:
+\newcommand*{\ReadClassInfo}{%
+ \read@package@infos\LoadClass{cls}}
+\newcommand*{\read@package@infos}[3]{%
+ %% #1 \Req.../Load..., #2 extension, #3 name list
+ \begingroup %% 2010/11/26
+ \let\@pr@videpackage\read@pr@videpackage
+ #1{#3}%
+ \endgroup \GetFileInfo{#3.#2}% %% 2010/11/26
+}
+ %% <- TODO more classes 2008/03/16
+\def\read@pr@videpackage[#1]{%
+ \expandafter\xdef\csname ver@\@currname.\@currext\endcsname{#1}%
+ \ifx\@currext\@clsextension
+ \typeout{Document Class: \@gtempa\space#1}%
+ \else
+ \wlog{Package: \@gtempa\space#1}%
+ \fi
+ \endinput}%
+ %% <- TODO \let\read@@... and just add \endinput 2008/03/19
+% |\ReadFileInfos{<list-of-filenames>}| with extensions:
+\newcommand*{\ReadFileInfos}[1]{%
+ \begingroup
+ \def\@providesfile##1[##2]{%
+ %% <- cf. second/final LaTeX def. 2008/03/19
+ \wlog{File: ##1 ##2}%
+ \expandafter\xdef\csname ver@##1\endcsname{##2}%
+ \endgroup \endinput}%
+ %% <- TODO \let\read@@... and just add
+ %% \endgroup\endinput 2008/03/19
+ %% 2008/03/19:
+ \def\ProvidesClass ##1{\ProvidesFile{##1.\@clsextension}}%
+ \def\ProvidesPackage##1{\ProvidesFile{##1.\@pkgextension}}%
+ \@for\@tempa:=#1\do{%
+ \edef\@tempa{\expandafter\read@no@spaces\@tempa\@nil}%
+ \input{\@tempa}%
+ \global\let\@gtempa\@tempa} %% 2010/11/26
+ \endgroup
+ \GetFileInfo\@gtempa %% 2010/11/26
+}
+\def\read@no@spaces#1#2\@nil{#1#2} %% 2008/03/23
+\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
+v0.3 2010/11/25 split off from former "myfiles.sty",
+ added \GetFileInfo
+ 2010/11/26 automatic \GetFileInfo
+ 2010/11/27 new/real documentation; more \newcommand*s;
+ \GetFileInfo redefined, \Use...;
+ \docnewline -> \\; NOTE etc.