adhocfilelist
—
[ abstract | overview | requirements | installing | related | background | customize | idea/thanks ] [ reload ]
\ProvidesFile
{
〈file〉
}
[
〈info〉
]
,
\ProvidesPackage
{
〈file〉
}
[
〈info〉
]
,
or \ProvidesClass
{
〈file〉
}
[
〈info〉
]
.
There is one line for each file, formatted about as with LaTeX’s
\listfiles
. This formatting can be varied, and the output may
additionally be saved in a plain text file. The files 〈file〉
are either (a) listed explicitly, separated by commas, or
(b) they are gathered by the Unix find utility.
For the latter, adhocfilelist provides a somewhat simplified
interface, especially for restricting the list of files
to those that have been modified “today” or a few days ago.
So you/I can check whether version info was updated correctly,
and it may allow filedate “consistency checks”
even with XeTeX (where \pdffilemoddate
is unavailable).
The package may thus be considered an extension of the latexfileversion (Harald Harders) and typeoutfileinfo packages that display 〈info〉 for a single file 〈file〉. Moreover, it is a somewhat simplified interface to the packages myfilist, longnamefilelist, nicefilelist, and filedate.
〈call〉 〈options〉 〈files〉The three parts are as follows:
PATH
,
or
alias
for
〈path〉adhocfilelist.sh.
-0
-a
〈integer〉
-
” or “+
” …)
-c
\Provides...
content with modification
date using filedate additionally.
TODO: The restriction to find (v0.7) is temporary, removing it is straightforward, but I may have to postpone this for a while.
-f
-g
).
For allowing certain file name extensions such as .tex
,
the star must be escaped and 〈files〉 best
has outer single quotes, such as
'-L ( -name \*
.tex -o -name \*
.sty )'
-F
〈find-file〉
-f
, stars must be escaped,
while other quoting seems not to be needed in 〈files〉.
-g
-f
.
-h
-i
〈tex-file〉
.tex
file that adhocfilelist.sh
generates internally — to get more individual settings
than adhocfilelist.sh’s internal defaults
(which are replaced by the content of 〈tex-file〉)
and than the options -l
and -n
provide.
-l
〈integer〉
-n
〈filename〉
-n .
” as a shorthand for
“-n
〈filename〉
” with a 〈filename〉 of eight characters.
-o
〈txt-file〉
-x
xelatex
rather than latex
(v0.7). — The
idea for this has been that the script should provide
“date consistency” checks (option -c
)
“even with XeTeX where \pdffilemoddate
is not available.” However, the script has used latex
before v0.7 which will run pdfTeX usually,
even when the user prefers typesetting with XeTeX,
and anyway it does not rely on \pdffilemoddate
.
The real problem with filedate and XeTeX is that
a reliable consistency check does not work
while typesetting with XeTeX. But filedate can be
used for “TeX scripts” too, i.e., without typesetting,
and that is what the present package does.
The present package does not provide consistency checks
while typesetting with XeTeX.
It should not be make a difference whether the “TeX script”
that adhocfilelist generates is run with XeTeX or with pdfTeX.
So the only “special XeTeX support” from here probably
will be the present -x
in case latex
does not work, maybe because pdfTeX or anything implementing
the latex
command is missing on the user’s (unusual) installation.
-0f
”
(too difficult with processing [parts of] find
expressions — -name
…).
.tex
(if so) may be omitted — unless -h
…
contact-ednotes.sty.de.vu
.
Actually the package was developed with the GNU bash shell and the GNU find utility on Ubuntu 10.04.
My impression is in fact
(looking at The Open Group’s
man page
for find)
that in order to use the find options
-0
, -a
, -f
, -F
,
and -g
, the GNU version of find is required,
because action -printf is used and essential (difficult without).
-l
option,
longnamefilelist must be installed additionally.
In order to use the -n
option,
nicefilelist must be installed additionally.
In order to use the -c
option,
filedate must be installed additionally.
The next section indicates details that may be
improve understanding the LaTeX-related command line options
-i
, -l
, and -n
.
-0
, -a
,
-f
, -F
, and -g
,
knowing something about the find utility
and the present interface to it may be helpful.
The options -i
, -l
, -n
,
and -o
refer to the myfilist package
and its enhancements by the packages longnamefilelist
and nicefilelist, and it may be helpful to know
what a “myfilist script” is.
man find
” in the terminal, finally see the
GNU manual.
adhocfilelist.sh forms the following find command line in order to get a comma-separated list of files:
These parts are as follows:find
〈prefix〉
〈files〉
〈day〉
-printf ,%f
where 〈more〉 in addition to files with extension-L -maxdepth 1 ( -name
\*
.tex -o〈more〉
)
.tex
allows
those with extensions .sty
, .cfg
, .cls
, .dtx
,
.def
, and .fd
— unless with options
-f
-F
〈find-file〉
-g
is not required with options
-0
and -a that switch into “find mode”
too without deleting 〈prefix〉, it is just a way to switch
into find mode otherwise without deleting 〈prefix〉.
-0
sets it to
-daystart -mtime 0
or -a
〈integer〉
sets it to
It follows that-daystart -mtime
〈integer〉
-0
has the same effect as
(is just a shorthand for) -a 0
-〈digits〉
”,
files modified since 〈digits〉 days ago
are allowed
A tricky little thing here is that 〈day〉
may be expected to be a restriction,
an additional criterion that a LaTeX source file
must meet to be listed. However, if 〈files〉 ends on
-o
for “or”, 〈day〉 becomes an
“additional possibility” for being listed …
TODO: This is different with option -c
(v0.7) whose functionality also may change soon.
\listfiles
so that its
output is not a list of files used for typesetting,
but a list of arbitrary files that is determined by commands
like
Essentially this is the command which the list of filenames that was 〈files〉 or that is produced by find is passed to. The list is generated by running a\ReadFileInfos
{
〈comma-separated-list-of-filenames〉
}
.tex
file that contains
these commands. Such a file has been called a
“myfilist script” here.
More precisely, such a script is (mostly) structured as follows:
〈loading-settings〉These parts are as follows:
〈collecting-infos〉
〈writing-to-screen+file〉
\RequirePackage
{
〈myfilist〉
}
.
By default, adhocfilelist.sh produces (roughly)
for 〈loading-settings〉 where 〈adhoc-adjust〉 adds technical details needed for use with adhocfilelist. (Final warnings are suppressed by a command\RequirePackage
{myfilist}
\EmptyFileList
〈adhoc-adjust〉
\NoBottomLines
,
this might be changed in the future.)
It has been a disadvantage of LaTeX’s \listfiles
functionality
that the resulting plain text file list looked good with base filenames
only that had up to eight characters. longnamefilelist
made up for this disadvantage, and nicefilelist
has additional refinements of aligning the list, proposed by
Martin Münch. To use them with
myfilist, they are loaded in 〈loading-settings〉
as well, and additional settings for column widths may be added there too.
This is what options -l
and -n
do.
Besides in their own PDF documentation (that you find by following the
links), the packages are also briefly described in that file
latexfileinfo_pkgs.htm
to be read by a web browser.
However, more refined settings may be needed that cannot
be controlled by adhocfilelist’s interface so far.
The option -i
〈tex-file〉
has the effect that 〈loading-settings〉 becomes
〈tex-file-content〉 〈adhoc-adjust〉where 〈tex-file-content〉 is the content of the (
.tex
file) 〈tex-file〉 (before \endinput
).
mentioned above.\ReadFileInfos
{
〈comma-separated-list-of-filenames〉
}
\ListFileInfos
or
With adhocfilelist, that “\ListFileInfos
[
〈txt-file〉
]
[
〈txt-file〉
]
”
is inserted on option -o
〈txt-file〉
.
\ReadListFileInfos
.
-F
〈find-file〉
and
-i
〈tex-file〉
will be needed
to deal with certain directories 〈dir〉.
Two ways come to my mind how to simplify this situation.
chmod
)
script file 〈script-file〉
with the following content:
Here 〈call〉 is as in the overview, and 〈more〉 may be empty or something else that you want to have fixed, such as〈call〉
-F
〈find-file〉
-i
〈tex-file〉
〈more〉
$@
-o
〈txt-file〉
.
Then you can vary additional options/parameters 〈add〉 by
./
〈script-file〉
〈add〉
alias
as follows:
(Note that there is no “alias
〈name〉
='
〈call〉
-F
〈center〉
/
〈find-file〉
-i
〈center〉
/
〈tex-file〉
〈more〉
'
$@
”.
“〈dir〉
/
〈tex-file〉
” could be replaced by
mere “〈tex-file〉
” if that 〈tex-file〉
is installed like a TeX package.)
Then you can vary additional options/parameters 〈add〉 by
〈name〉
〈add〉
\ProvideFile
contents of two
files I knew I had edited that day.
On 2012-09-26, I had thought about simplifying typeoutfileinfo
by using a single command line without any piping.
I realized that LaTeX s \typeout
could be replaced by
\ReadFileInfos
from myfilist.
Therefore “ad hoc”.
Maybe the same day later,
I realized that I could no longer remember which files I changed that day.
In July I had discovered $(find ...)
. Now I thought that this
could be used here. “Ad hoc” is less appropriate here, and first I thought
that there will be different script files for explicitly specified files
than for applying find.
Only then I learnt real shell programming by googling, kind of chance,
and most helpfully from Chapter 3 of Jürgen Wolfs
OpenBook
from Galileo Press
(getopts
— bad here, however)
and Prof. Jürgen Plates
lecture notes
(“Optionen ermitteln” — “by hand”).
Then quoting/escaping for filename extensions with find became difficult … Quotation marks and “positional parameters” with the shell are very difficult/painful — TeX is more straightforward … On the other hand it is nice that the entire command line with all the “parameters” is gobbled.
Last revised 2013-01-04 © Uwe Lück
(using blog.sty)
License: LPPL 1.3c or later, author-maintained.