| 1 |
<!DOCTYPE html> |
| 2 |
<!-- generated from |
| 3 |
|
| 4 |
adhocfilelist.tex, 2012/11/19 documenting adhocfilelist (UL), |
| 5 |
|
| 6 |
with blog.sty, 2013-01-04 --> |
| 7 |
<html><head> <meta http-equiv="content-type" content="text/html; ISO-8859-1"> |
| 8 |
<meta name="robots" content="index,follow,noarchive"> |
| 9 |
<title>List LaTeX file infos according to command line</title> |
| 10 |
|
| 11 |
</head><body> |
| 12 |
<a name="top-of-page"></a> |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
<h1><code>adhocfilelist</code> — |
| 18 |
<table width="" height="6" border="0" cellpadding="0" cellspacing="0"><tbody> |
| 19 |
<!-- HVspace --> |
| 20 |
<tr valign="top"><td></td> </tr> |
| 21 |
|
| 22 |
</tbody></table> |
| 23 |
Listing LaTeX Source File Infos<br> According to Command Line</h1> |
| 24 |
|
| 25 |
<p> |
| 26 |
<small> |
| 27 |
[ <a href="#abstract">abstract</a> | |
| 28 |
<a href="#over">overview</a> | |
| 29 |
<a href="#required">requirements</a> | |
| 30 |
<a href="#install">installing</a> | |
| 31 |
<a href="#related">related</a> | |
| 32 |
<a href="#back">background</a> | |
| 33 |
<a href="#custom">customize</a> | |
| 34 |
<a href="#idea">idea/thanks</a> ]  |
| 35 |
[ <i><a href="adhocfilelist.htm">reload</a></i> ] |
| 36 |
|
| 37 |
</small> |
| 38 |
|
| 39 |
<h2><a name="abstract"></a>Abstract<a href="#abstract">.</a></h2> |
| 40 |
<span style="font-family:sans-serif">adhocfilelist.sh</span> is a shell script with command line options |
| 41 |
and parameters that displays ⟨<i>info</i>⟩ for files ⟨<i>file</i>⟩ |
| 42 |
on screen that (i) are indicated on the command line and |
| 43 |
(ii) contain <code>\ProvidesFile</code><code>{</code><code>⟨<i>file</i>⟩</code><code>}</code><code>[</code><code>⟨<i>info</i>⟩</code><code>]</code>, |
| 44 |
<code>\ProvidesPackage</code><code>{</code><code>⟨<i>file</i>⟩</code><code>}</code><code>[</code><code>⟨<i>info</i>⟩</code><code>]</code>, |
| 45 |
or <code>\ProvidesClass</code><code>{</code><code>⟨<i>file</i>⟩</code><code>}</code><code>[</code><code>⟨<i>info</i>⟩</code><code>]</code>. |
| 46 |
There is one line for each file, formatted about as with LaTeX’s |
| 47 |
<code>\listfiles</code>. This formatting can be varied, and the output may |
| 48 |
additionally be saved in a plain text file. The files ⟨<i>file</i>⟩ |
| 49 |
are either (a) listed explicitly, separated by commas, or |
| 50 |
(b) they are gathered by the Unix <span style="font-family:sans-serif"><a href="http://en.wikipedia.org/wiki/find" target="_blank">find</a></span> utility. |
| 51 |
For the latter, <span style="font-family:sans-serif">adhocfilelist</span> provides a somewhat simplified |
| 52 |
interface, especially for restricting the list of files |
| 53 |
to those that have been modified “today” or a few days ago. |
| 54 |
So you/I can check whether version info was updated correctly, |
| 55 |
and it may allow <a href="http://www.ctan.org/pkg/filedate" target="_blank"><span style="font-family:sans-serif">filedate</span></a> “consistency checks” |
| 56 |
even with <a href="http://www.ctan.org/pkg/xetex" target="_blank"><span style="font-family:sans-serif">XeTeX</span></a> (where <code>\pdffilemoddate</code> |
| 57 |
is unavailable). |
| 58 |
<p> |
| 59 |
The package may thus be considered an extension of the |
| 60 |
<a href="http://www.ctan.org/pkg/latexfileversion" target="_blank"><span style="font-family:sans-serif">latexfileversion</span></a> (Harald <a href="http://www.ctan.org/author/harders" target="_blank">Harders</a>) |
| 61 |
and <a href="http://www.ctan.org/pkg/typeoutfileinfo" target="_blank"><span style="font-family:sans-serif">typeoutfileinfo</span></a> packages |
| 62 |
that display ⟨<i>info</i>⟩ for a <em>single</em> file ⟨<i>file</i>⟩. |
| 63 |
Moreover, it is a somewhat simplified interface to the packages |
| 64 |
<a href="http://www.ctan.org/pkg/myfilist" target="_blank"><span style="font-family:sans-serif">myfilist</span></a>, <a href="http://www.ctan.org/pkg/longnamefilelist" target="_blank"><span style="font-family:sans-serif">longnamefilelist</span></a>, |
| 65 |
<a href="http://www.ctan.org/pkg/nicefilelist" target="_blank"><span style="font-family:sans-serif">nicefilelist</span></a>, and <a href="http://www.ctan.org/pkg/filedate" target="_blank"><span style="font-family:sans-serif">filedate</span></a>. |
| 66 |
|
| 67 |
<h2><a name="over"></a>Overview of command line contents<a href="#over">.</a></h2> |
| 68 |
The general structure of a command line using <span style="font-family:sans-serif">adhocfilelist</span> is |
| 69 |
<blockquote> |
| 70 |
<a href="#call">⟨<i>call</i>⟩</a> |
| 71 |
<a href="#opts">⟨<i>options</i>⟩</a> |
| 72 |
<a href="#files">⟨<i>files</i>⟩</a> |
| 73 |
|
| 74 |
</blockquote> |
| 75 |
The three parts are as follows: |
| 76 |
<dl> |
| 77 |
<dt><strong>⟨<i>call</i>⟩<a name="call"></a></strong><dd> |
| 78 |
This is either |
| 79 |
<ul> |
| 80 |
</li> |
| 81 |
<li>⟨<i>path</i>⟩<span style="font-family:sans-serif">adhocfilelist.sh</span> |
| 82 |
where ⟨<i>path</i>⟩ is “./” or something, |
| 83 |
depending on where you place the file <span style="font-family:sans-serif">adhocfilelist.sh</span>, |
| 84 |
or on your use of <a href="http://en.wikipedia.org/wiki/symbolic link" target="_blank">symbolic link</a>s, |
| 85 |
the environment variable <code><a href="http://en.wikipedia.org/wiki/PATH (variable)" target="_blank">PATH</a></code>, |
| 86 |
or |
| 87 |
</li> |
| 88 |
<li>an <code><a href="http://en.wikipedia.org/wiki/alias (command)" target="_blank">alias</a></code> for |
| 89 |
⟨<i>path</i>⟩<span style="font-family:sans-serif">adhocfilelist.sh</span>. |
| 90 |
</li> |
| 91 |
</ul> |
| 92 |
<dt><strong>⟨<i>options</i>⟩<a name="opts"></a></strong><dd> |
| 93 |
|
| 94 |
Some options “switch into <strong><span style="font-family:sans-serif"><a href="http://en.wikipedia.org/wiki/find" target="_blank">find</a></span> mode</strong>”, |
| 95 |
affecting the interpretation of <strong>⟨<i>files</i>⟩</strong>, marked by “<strong>(f)</strong>”. |
| 96 |
Their description may be inaccurate here, |
| 97 |
understanding the details may require some knowledge of <span style="font-family:sans-serif">find</span> |
| 98 |
(see “<a href="#back">background</a>” below). |
| 99 |
Some options have one parameter, some have none. |
| 100 |
<dl> |
| 101 |
<dt><strong><code>-0</code></strong><dd> <strong>(f)</strong> |
| 102 |
List files modified “<strong>today</strong>” only (unless …) |
| 103 |
<dt><strong><code>-a</code> <code>⟨<i>integer</i>⟩</code></strong><dd> <strong>(f)</strong> |
| 104 |
List files modified ⟨<i>integer</i>⟩ days <strong>ago</strong> only |
| 105 |
(unless ⟨<i>integer</i>⟩ starts with “<code>-</code>” or “<code>+</code>” …) |
| 106 |
<dt><strong><code>-c</code></strong><dd> <strong>(f)</strong> |
| 107 |
Compare date according to <code>\Provides...</code> content with modification |
| 108 |
date using <a href="http://www.ctan.org/pkg/filedate" target="_blank"><span style="font-family:sans-serif">filedate</span></a> additionally. |
| 109 |
<p> |
| 110 |
<span style="color:red"><acronym>TODO</acronym></span>: The restriction to <span style="font-family:sans-serif">find</span> (v0.7) is temporary, removing it is |
| 111 |
straightforward, but I may have to postpone this for a while. |
| 112 |
<dt><strong><code>-f</code></strong><dd> <strong>(f)</strong> |
| 113 |
Add ⟨<i>files</i>⟩ to other <strong><span style="font-family:sans-serif">find</span></strong> criteria, |
| 114 |
<strong>replacing</strong> internal default settings |
| 115 |
(as opposed to <code>-g</code>). |
| 116 |
For allowing certain file name extensions such as <code>.tex</code>, |
| 117 |
the star must be escaped and ⟨<i>files</i>⟩ best |
| 118 |
has outer single quotes, such as |
| 119 |
<blockquote> |
| 120 |
|
| 121 |
<code>'-L ( -name <code>\*</code>.tex -o -name <code>\*</code>.sty )'</code> |
| 122 |
|
| 123 |
|
| 124 |
</blockquote> |
| 125 |
<dt><strong><code>-F</code> <code>⟨<i>find-file</i>⟩</code></strong><dd> <strong>(f)</strong> |
| 126 |
Add content of the <strong>file</strong> ⟨<i>find-file</i>⟩ to other <strong><span style="font-family:sans-serif">find</span></strong> criteria. |
| 127 |
As compared with <code>-f</code>, stars must be escaped, |
| 128 |
while other quoting seems not to be needed in ⟨<i>files</i>⟩. |
| 129 |
<dt><strong><code>-g</code></strong><dd> <strong>(f)</strong> |
| 130 |
Add ⟨<i>files</i>⟩ to other <strong><span style="font-family:sans-serif">find</span></strong> criteria, |
| 131 |
among which some hopefully “<strong>generally useful</strong>” |
| 132 |
are added from within <span style="font-family:sans-serif">adhocfilelist.sh</span>. |
| 133 |
As to quoting/escaping in ⟨<i>files</i>⟩, |
| 134 |
this is as with <code>-f</code>. |
| 135 |
<dt><strong><code>-h</code></strong><dd> |
| 136 |
Display an overview (brief version of present one, “<strong>help</strong>”), |
| 137 |
and ignore everything else of the command line. |
| 138 |
<dt><strong><code>-i</code> <code>⟨<i>tex-file</i>⟩</code></strong><dd> |
| 139 |
Prepend (“<strong>input</strong>”) contents of the file ⟨<i>tex-file</i>⟩ |
| 140 |
to the temporary <code>.tex</code> file that <span style="font-family:sans-serif">adhocfilelist.sh</span> |
| 141 |
generates internally — to get more individual settings |
| 142 |
than <span style="font-family:sans-serif">adhocfilelist.sh</span>’s internal defaults |
| 143 |
(which are <strong>replaced</strong> by the content of ⟨<i>tex-file</i>⟩) |
| 144 |
and than the options <code>-l</code> and <code>-n</code> provide. |
| 145 |
<dt><strong><code>-l</code> <code>⟨<i>integer</i>⟩</code></strong><dd> |
| 146 |
Format list by the <strong><a href="http://www.ctan.org/pkg/longnamefilelist" target="_blank"><span style="font-family:sans-serif">longnamefilelist</span></a></strong> package |
| 147 |
where ⟨<i>integer</i>⟩ is the maximum length of base |
| 148 |
<a href="http://en.wikipedia.org/wiki/filename" target="_blank">filename</a>s in the list (about as …) |
| 149 |
<dt><strong><code>-n</code> <code>⟨<i>filename</i>⟩</code></strong><dd> |
| 150 |
Format list by the <strong><a href="http://www.ctan.org/pkg/nicefilelist" target="_blank"><span style="font-family:sans-serif">nicefilelist</span></a></strong> package |
| 151 |
where ⟨<i>filename</i>⟩ is the longest base <a href="http://en.wikipedia.org/wiki/filename" target="_blank">filename</a> (or a template). |
| 152 |
|
| 153 |
If base filenames do <em>not</em> have more than eight characters, |
| 154 |
you can use “<strong><code>-n .</code></strong>” as a shorthand for |
| 155 |
“<code>-n</code> <code>⟨<i>filename</i>⟩</code>” with a ⟨<i>filename</i>⟩ of eight characters. |
| 156 |
<dt><strong><code>-o</code> <code>⟨<i>txt-file</i>⟩</code></strong><dd> |
| 157 |
Save the displayed file info list (“<strong>output</strong>”) |
| 158 |
as plain text file ⟨<i>txt-file</i>⟩ also. |
| 159 |
<dt><strong><code>-x</code></strong><dd> |
| 160 |
Use <code>xelatex</code> rather than <code>latex</code> (v0.7). — The |
| 161 |
idea for this has been that the script should provide |
| 162 |
“date consistency” checks (<strong>option <code>-c</code></strong>) |
| 163 |
“even with <a href="http://www.ctan.org/pkg/xetex" target="_blank"><span style="font-family:sans-serif">XeTeX</span></a> where <code>\pdffilemoddate</code> is not available.” However, the script has used <code>latex</code> |
| 164 |
before v0.7 which will run <a href="http://www.ctan.org/pkg/pdftex" target="_blank"><span style="font-family:sans-serif">pdfTeX</span></a> usually, |
| 165 |
even when the user prefers <em>typesetting</em> with XeTeX, |
| 166 |
and anyway it does not rely on <code>\pdffilemoddate</code>. |
| 167 |
The real problem with <a href="http://www.ctan.org/pkg/filedate" target="_blank"><span style="font-family:sans-serif">filedate</span></a> and XeTeX is that |
| 168 |
a reliable consistency check does not work |
| 169 |
<em>while typesetting with XeTeX</em>. But <span style="font-family:sans-serif">filedate</span> can be |
| 170 |
used for “TeX scripts” too, i.e., <em>without</em> typesetting, |
| 171 |
and that is what the present package does. |
| 172 |
The present package does <em>not</em> provide consistency checks |
| 173 |
<em>while typesetting with XeTeX</em>. |
| 174 |
It should not be make a difference whether the “TeX script” |
| 175 |
that <span style="font-family:sans-serif">adhocfilelist</span> generates is run with XeTeX or with pdfTeX. |
| 176 |
So the only “special XeTeX support” from here probably |
| 177 |
will be the present <strong><code>-x</code></strong> in case <code>latex</code> |
| 178 |
<em>does not work</em>, maybe because pdfTeX or anything implementing |
| 179 |
the <code>latex</code> command is missing on the user’s (unusual) installation. |
| 180 |
|
| 181 |
</dl> |
| 182 |
Options can <em>not</em> be “contracted” like “<code>-0f</code>” |
| 183 |
(too difficult with processing [parts of] <span style="font-family:sans-serif">find</span> |
| 184 |
expressions — <code>-name</code> …). |
| 185 |
<dt><strong>⟨<i>files</i>⟩<a name="files"></a></strong><dd> |
| 186 |
Whenever an option “switches into <span style="font-family:sans-serif"><a href="http://en.wikipedia.org/wiki/find" target="_blank">find</a></span> mode”, |
| 187 |
⟨<i>files</i>⟩ is interpreted as part of a command line for the |
| 188 |
<span style="font-family:sans-serif">find</span> utility. Otherwise, ⟨<i>files</i>⟩ is expected to be a |
| 189 |
comma-separated list of filenames (for LaTeX source files), |
| 190 |
whose extension <code>.tex</code> (if so) may be omitted — unless <code>-h</code> … |
| 191 |
|
| 192 |
</dl> |
| 193 |
|
| 194 |
<h2><a name="required"></a>Requirements<a href="#required">.</a></h2> |
| 195 |
<dl> |
| 196 |
<dt><strong>System</strong><dd> |
| 197 |
The package will work on a <a href="http://en.wikipedia.org/wiki/Unix-like" target="_blank">Unix-like</a> system only, |
| 198 |
but I am not expert enough to judge what additional restrictions hold. |
| 199 |
As I could not make work everything that should work according to |
| 200 |
documentation, I expect the other way round that what works on |
| 201 |
my installation may not work at other Unix-like installations. |
| 202 |
If something doesn’t work at your installation, please tell me via |
| 203 |
<a href="http://contact-ednotes.sty.de.vu" target="_blank"><code>contact-ednotes.sty.de.vu</code></a>. |
| 204 |
<p> |
| 205 |
Actually the package was developed with the <a href="http://en.wikipedia.org/wiki/GNU bash" target="_blank">GNU bash</a> |
| 206 |
shell and the |
| 207 |
<a href="http://en.wikipedia.org/wiki/GNU Find Utilities" target="_blank"><abbr>GNU</abbr> <span style="font-family:sans-serif">find</span> utility</a> on |
| 208 |
<a href="http://en.wikipedia.org/wiki/Ubuntu (operating system)" target="_blank">Ubuntu</a> 10.04. |
| 209 |
<p> |
| 210 |
My impression is in fact |
| 211 |
(looking at <a href="http://en.wikipedia.org/wiki/The Open Group" target="_blank">The Open Group</a>’s |
| 212 |
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html" target="_blank">man page</a> |
| 213 |
for <span style="font-family:sans-serif">find</span>) |
| 214 |
that in order to use the <strong><span style="font-family:sans-serif">find</span></strong> options |
| 215 |
<strong><code>-0</code></strong>, <strong><code>-a</code></strong>, <strong><code>-f</code></strong>, <strong><code>-F</code></strong>, |
| 216 |
and <strong><code>-g</code></strong>, the <strong><abbr>GNU</abbr></strong> version of <span style="font-family:sans-serif">find</span> is required, |
| 217 |
because action <strong>-printf</strong> is used and essential (difficult without). |
| 218 |
<dt><strong>LaTeX</strong><dd> |
| 219 |
The package requires that the <a href="http://www.ctan.org/pkg/fileinfo" target="_blank"><span style="font-family:sans-serif">fileinfo</span></a> bundle is installed. |
| 220 |
In order to use the <strong><code>-l</code></strong> option, |
| 221 |
<a href="http://www.ctan.org/pkg/longnamefilelist" target="_blank"><span style="font-family:sans-serif">longnamefilelist</span></a> must be installed additionally. |
| 222 |
In order to use the <strong><code>-n</code></strong> option, |
| 223 |
<a href="http://www.ctan.org/pkg/nicefilelist" target="_blank"><span style="font-family:sans-serif">nicefilelist</span></a> must be installed additionally. |
| 224 |
In order to use the <strong><code>-c</code></strong> option, |
| 225 |
<a href="http://www.ctan.org/pkg/filedate" target="_blank"><span style="font-family:sans-serif">filedate</span></a> must be installed additionally. |
| 226 |
|
| 227 |
</dl> |
| 228 |
|
| 229 |
<h2><a name="install"></a>Installing<a href="#install">.</a></h2> |
| 230 |
No more advice than implied by the section on “<a href="#call">⟨<i>call</i>⟩</a>” |
| 231 |
can be given right now. |
| 232 |
|
| 233 |
<h2><a name="related"></a>Related packages<a href="#related">.</a></h2> |
| 234 |
The file |
| 235 |
<a href="http://mirror.ctan.org/info/latexfileinfo-pkgs/latexfileinfo_pkgs.htm" target="_blank"><span style="font-family:sans-serif">latexfileinfo_pkgs.htm</span></a> |
| 236 |
describes related packages available on |
| 237 |
|
| 238 |
<abbr><a href="http://en.wikipedia.org/wiki/CTAN" target="_blank">CTAN</a></abbr> |
| 239 |
in some detail. |
| 240 |
The most obvious ones have been mentioned above already. |
| 241 |
|
| 242 |
<p> |
| 243 |
The <a href="#back">next section</a> indicates details that may be |
| 244 |
improve understanding the LaTeX-related command line options |
| 245 |
<code>-i</code>, <code>-l</code>, and <code>-n</code>. |
| 246 |
|
| 247 |
<h2><a name="back"></a>Background<a href="#back">.</a></h2> |
| 248 |
For understanding the options <strong><code>-0</code></strong>, <strong><code>-a</code></strong>, |
| 249 |
<strong><code>-f</code></strong>, <strong><code>-F</code></strong>, and <strong><code>-g</code></strong>, |
| 250 |
knowing something about the <span style="font-family:sans-serif"><a href="http://en.wikipedia.org/wiki/find" target="_blank">find</a></span> utility |
| 251 |
and the present <a href="#back-find">interface</a> to it may be helpful. |
| 252 |
The options <strong><code>-i</code></strong>, <strong><code>-l</code></strong>, <strong><code>-n</code></strong>, |
| 253 |
and <strong><code>-o</code></strong> refer to the <a href="http://www.ctan.org/pkg/myfilist" target="_blank"><span style="font-family:sans-serif">myfilist</span></a> package |
| 254 |
and its enhancements by the packages <a href="http://www.ctan.org/pkg/longnamefilelist" target="_blank"><span style="font-family:sans-serif">longnamefilelist</span></a> |
| 255 |
and <a href="http://www.ctan.org/pkg/nicefilelist" target="_blank"><span style="font-family:sans-serif">nicefilelist</span></a>, and it may be helpful to know |
| 256 |
what a “<a href="#my-script"><span style="font-family:sans-serif">myfilist</span> script</a>” is. |
| 257 |
<dl> |
| 258 |
<dt><strong><span style="font-family:sans-serif">find</span><a name="back-find"></a></strong><dd> |
| 259 |
We are describing the <strong>interface</strong> to <span style="font-family:sans-serif"><a href="http://en.wikipedia.org/wiki/find" target="_blank">find</a></span>. |
| 260 |
To learn about the contents of a <span style="font-family:sans-serif">find</span> command line, |
| 261 |
the <a href="http://en.wikipedia.org/wiki/find" target="_blank">Wikipedia article</a> may be a good start, |
| 262 |
next enter “<code>man find</code>” in the terminal, finally see the |
| 263 |
<a href="http://gnu.org/software/findutils/manual/find.html" target="_blank"><abbr>GNU</abbr> manual</a>. |
| 264 |
<p> |
| 265 |
<span style="font-family:sans-serif">adhocfilelist.sh</span> forms the following <span style="font-family:sans-serif">find</span> command line |
| 266 |
in order to get a comma-separated list of files: |
| 267 |
<blockquote> |
| 268 |
<code>find</code> |
| 269 |
<a href="#back-f-prefix"><code>⟨<i>prefix</i>⟩</code></a> |
| 270 |
<a href="#back-f-files"><code>⟨<i>files</i>⟩</code></a> |
| 271 |
<a href="#back-f-day"><code>⟨<i>day</i>⟩</code></a> |
| 272 |
<code>-printf ,%f</code> |
| 273 |
|
| 274 |
</blockquote> |
| 275 |
These parts are as follows: |
| 276 |
<dl> |
| 277 |
<dt><strong>⟨<i>prefix</i>⟩<a name="back-f-prefix"></a></strong><dd> |
| 278 |
is |
| 279 |
<blockquote> |
| 280 |
<code>-L -maxdepth 1 ( -name <code>\*</code>.tex -o </code><code>⟨<i>more</i>⟩</code><code> )</code> |
| 281 |
|
| 282 |
|
| 283 |
</blockquote> |
| 284 |
where ⟨<i>more</i>⟩ in addition to files with extension <code>.tex</code> allows |
| 285 |
those with extensions <code>.sty</code>, <code>.cfg</code>, <code>.cls</code>, <code>.dtx</code>, |
| 286 |
<code>.def</code>, and <code>.fd</code> — <strong>unless</strong> with <strong>options</strong> |
| 287 |
<dl> |
| 288 |
<dt><strong><code>-f</code></strong><dd> |
| 289 |
where ⟨<i>prefix</i>⟩ is empty |
| 290 |
<dt><strong><code>-F</code> <code>⟨<i>find-file</i>⟩</code></strong><dd> |
| 291 |
where ⟨<i>prefix</i>⟩ is the content of the file ⟨<i>find-file</i>⟩. |
| 292 |
|
| 293 |
</dl> |
| 294 |
Option <strong><code>-g</code></strong> is not required with options |
| 295 |
<strong><code>-0</code></strong> and <strong>-a</strong> that switch into “<strong><span style="font-family:sans-serif">find</span> mode</strong>” |
| 296 |
too without deleting ⟨<i>prefix</i>⟩, it is just a way to switch |
| 297 |
into <span style="font-family:sans-serif">find</span> mode otherwise without deleting ⟨<i>prefix</i>⟩. |
| 298 |
<dt><strong>⟨<i>files</i>⟩<a name="back-f-files"></a></strong><dd> |
| 299 |
is as in the <a href="#files">overview</a>. |
| 300 |
<dt><strong>⟨<i>day</i>⟩<a name="back-f-day"></a></strong><dd> |
| 301 |
is empty, unless <strong><code>-0</code></strong> sets it to |
| 302 |
<blockquote> |
| 303 |
<code>-daystart -mtime 0</code> |
| 304 |
|
| 305 |
</blockquote> |
| 306 |
or <strong><code>-a</code> <code>⟨<i>integer</i>⟩</code></strong> sets it to |
| 307 |
<blockquote> |
| 308 |
<code>-daystart -mtime </code><code>⟨<i>integer</i>⟩</code> |
| 309 |
|
| 310 |
</blockquote> |
| 311 |
It follows that |
| 312 |
<ul> |
| 313 |
</li> |
| 314 |
<li><strong><code>-0</code></strong> has the same effect as |
| 315 |
(is just a shorthand for) <strong><code>-a 0</code></strong> |
| 316 |
</li> |
| 317 |
<li>if ⟨<i>integer</i>⟩ is “<code>-⟨<i>digits</i>⟩</code>”, |
| 318 |
files modified <em>since</em> ⟨<i>digits</i>⟩ days ago |
| 319 |
are allowed |
| 320 |
</li> |
| 321 |
</ul> |
| 322 |
—cf. <abbr>GNU</abbr> documentation on |
| 323 |
<a href="http://gnu.org/software/findutils/manual/html_node/find_html/Age-Ranges.html" target="_blank">age ranges.</a> |
| 324 |
<p> |
| 325 |
A <strong>tricky</strong> little thing here is that ⟨<i>day</i>⟩ |
| 326 |
may be <em>expected</em> to be a <em>restriction</em>, |
| 327 |
an <em>additional</em> criterion that a LaTeX source file |
| 328 |
must meet to be listed. However, if ⟨<i>files</i>⟩ ends on |
| 329 |
<strong><code>-o</code></strong> for “or”, ⟨<i>day</i>⟩ becomes an |
| 330 |
“additional possibility” for being listed … |
| 331 |
<p> |
| 332 |
<span style="color:red"><acronym>TODO</acronym></span>: This is different with <strong>option <code>-c</code></strong> |
| 333 |
(v0.7) whose functionality also may change soon. |
| 334 |
|
| 335 |
</dl> |
| 336 |
<dt><strong><span style="font-family:sans-serif">myfilist</span><a name="my-script"></a></strong><dd> |
| 337 |
The LaTeX package <a href="http://www.ctan.org/pkg/myfilist" target="_blank"><span style="font-family:sans-serif">myfilist</span></a> provides some commands |
| 338 |
to control the input of LaTeX’s <code>\listfiles</code> so that its |
| 339 |
output is not a list of files used for typesetting, |
| 340 |
but a list of arbitrary files that is determined by commands |
| 341 |
like |
| 342 |
<blockquote> |
| 343 |
<code>\ReadFileInfos</code><code>{</code><code>⟨<i>comma-separated-list-of-filenames</i>⟩</code><code>}</code> |
| 344 |
|
| 345 |
</blockquote> |
| 346 |
Essentially this is the command which the list of filenames that |
| 347 |
was ⟨<i>files</i>⟩ or that is produced by <span style="font-family:sans-serif">find</span> is passed to. |
| 348 |
The list is generated by running a <code>.tex</code> file that contains |
| 349 |
these commands. Such a file has been called a |
| 350 |
“<strong><span style="font-family:sans-serif">myfilist</span> script</strong>” here. |
| 351 |
More precisely, such a script is (mostly) structured as follows: |
| 352 |
<blockquote> |
| 353 |
<a href="#back-load-set">⟨<i>loading-settings</i>⟩</a><br> |
| 354 |
<a href="#back-coll-infos">⟨<i>collecting-infos</i>⟩</a><br> |
| 355 |
<a href="#back-write">⟨<i>writing-to-screen+file</i>⟩</a> |
| 356 |
|
| 357 |
</blockquote> |
| 358 |
These parts are as follows: |
| 359 |
<dl> |
| 360 |
<dt><strong>⟨<i>loading-settings</i>⟩<a name="back-load-set"></a></strong><dd> |
| 361 |
at least issues <code>\RequirePackage</code><code>{</code><code>⟨<i>myfilist</i>⟩</code><code>}</code>. |
| 362 |
By default, <span style="font-family:sans-serif">adhocfilelist.sh</span> produces (roughly) |
| 363 |
<blockquote> |
| 364 |
<code>\RequirePackage</code><code>{myfilist}</code><code>\EmptyFileList</code> |
| 365 |
<code>⟨<i>adhoc-adjust</i>⟩</code> |
| 366 |
|
| 367 |
</blockquote> |
| 368 |
for ⟨<i>loading-settings</i>⟩ where ⟨<i>adhoc-adjust</i>⟩ |
| 369 |
adds technical details needed for use with <span style="font-family:sans-serif">adhocfilelist</span>. |
| 370 |
(Final warnings are suppressed by a command <code>\NoBottomLines</code>, |
| 371 |
this might be changed in the future.) |
| 372 |
<p> |
| 373 |
It has been a disadvantage of LaTeX’s <code>\listfiles</code> functionality |
| 374 |
that the resulting plain text file list looked good with base filenames |
| 375 |
only that had up to eight characters. <a href="http://www.ctan.org/pkg/longnamefilelist" target="_blank"><span style="font-family:sans-serif">longnamefilelist</span></a> |
| 376 |
made up for this disadvantage, and <a href="http://www.ctan.org/pkg/nicefilelist" target="_blank"><span style="font-family:sans-serif">nicefilelist</span></a> |
| 377 |
has additional refinements of aligning the list, proposed by |
| 378 |
Martin <a href="http://www.ctan.org/author/muench-hm" target="_blank">Münch</a>. To use them with |
| 379 |
<span style="font-family:sans-serif">myfilist</span>, they are loaded in ⟨<i>loading-settings</i>⟩ |
| 380 |
as well, and additional settings for column widths may be added there too. |
| 381 |
This is what <strong>options</strong> <strong><code>-l</code></strong> and <strong><code>-n</code></strong> do. |
| 382 |
Besides in their own <abbr>PDF</abbr> documentation (that you find by following the |
| 383 |
links), the packages are also briefly described in that file |
| 384 |
<a href="http://mirror.ctan.org/info/latexfileinfo-pkgs/latexfileinfo_pkgs.htm" target="_blank"><span style="font-family:sans-serif">latexfileinfo_pkgs.htm</span></a> |
| 385 |
to be read by a web browser. |
| 386 |
<p> |
| 387 |
However, more refined settings may be needed that cannot |
| 388 |
be controlled by <span style="font-family:sans-serif">adhocfilelist</span>’s interface so far. |
| 389 |
The <strong>option</strong> <strong><code>-i</code> <code>⟨<i>tex-file</i>⟩</code></strong> |
| 390 |
has the effect that ⟨<i>loading-settings</i>⟩ becomes |
| 391 |
<blockquote> |
| 392 |
⟨<i>tex-file-content</i>⟩ |
| 393 |
⟨<i>adhoc-adjust</i>⟩ |
| 394 |
|
| 395 |
</blockquote> |
| 396 |
where ⟨<i>tex-file-content</i>⟩ is the content of the |
| 397 |
(<code>.tex</code> file) ⟨<i>tex-file</i>⟩ (before <code>\endinput</code>). |
| 398 |
<dt><strong>⟨<i>collecting-infos</i>⟩<a name="back-coll-infos"></a></strong><dd> |
| 399 |
essentially is that |
| 400 |
<blockquote> |
| 401 |
<code>\ReadFileInfos</code><code>{</code><code>⟨<i>comma-separated-list-of-filenames</i>⟩</code><code>}</code> |
| 402 |
|
| 403 |
</blockquote> |
| 404 |
mentioned above. |
| 405 |
<dt><strong>⟨<i>writing-to-screen+file</i>⟩<a name="back-write"></a></strong><dd> |
| 406 |
essentially is <code>\ListFileInfos</code> or |
| 407 |
<blockquote> |
| 408 |
<code>\ListFileInfos</code><code>[</code><code>⟨<i>txt-file</i>⟩</code><code>]</code> |
| 409 |
|
| 410 |
</blockquote> |
| 411 |
With <span style="font-family:sans-serif">adhocfilelist</span>, that “<code>[</code><code>⟨<i>txt-file</i>⟩</code><code>]</code>” |
| 412 |
is inserted on <strong>option</strong> <strong><code>-o</code> <code>⟨<i>txt-file</i>⟩</code></strong>. |
| 413 |
|
| 414 |
</dl> |
| 415 |
However, <span style="font-family:sans-serif">myfilist</span> has been extended at the occasion |
| 416 |
of preparing <span style="font-family:sans-serif">adhocfilelist</span> so that the sections |
| 417 |
⟨<i>collecting-infos</i>⟩ and ⟨<i>writing-to-screen+file</i>⟩ |
| 418 |
may “collapse” into a single command starting with |
| 419 |
<code>\ReadListFileInfos</code>. |
| 420 |
|
| 421 |
</dl> |
| 422 |
|
| 423 |
<h2><a name="custom"></a>General customization<a href="#custom">.</a></h2> |
| 424 |
In general, options <strong><code>-F</code> <code>⟨<i>find-file</i>⟩</code></strong> and |
| 425 |
<strong><code>-i</code> <code>⟨<i>tex-file</i>⟩</code></strong> will be needed |
| 426 |
to deal with certain directories ⟨<i>dir</i>⟩. |
| 427 |
Two ways come to my mind how to simplify this situation. |
| 428 |
<ol> |
| 429 |
</li> |
| 430 |
<li>⟨<i>find-file</i>⟩ and ⟨<i>tex-file</i>⟩ may be |
| 431 |
in the same directory ⟨<i>dir</i>⟩, and the latter may es well |
| 432 |
contain an executable (<code><a href="http://en.wikipedia.org/wiki/chmod" target="_blank">chmod</a></code>) |
| 433 |
script file ⟨<i>script-file</i>⟩ |
| 434 |
with the following content: |
| 435 |
<blockquote> |
| 436 |
<a href="#call"><code>⟨<i>call</i>⟩</code></a> |
| 437 |
<code>-F </code><code>⟨<i>find-file</i>⟩</code> |
| 438 |
<code>-i </code><code>⟨<i>tex-file</i>⟩</code> |
| 439 |
<code>⟨<i>more</i>⟩</code> |
| 440 |
<code>$@</code> |
| 441 |
|
| 442 |
</blockquote> |
| 443 |
Here ⟨<i>call</i>⟩ is as in the <a href="#call">overview</a>, |
| 444 |
and ⟨<i>more</i>⟩ may be empty or something else that you |
| 445 |
want to have fixed, such as <strong><code>-o</code> <code>⟨<i>txt-file</i>⟩</code></strong>. |
| 446 |
<p> |
| 447 |
<strong>Then</strong> you can <strong>vary</strong> additional options/parameters |
| 448 |
⟨<i>add</i>⟩ by |
| 449 |
<blockquote> |
| 450 |
<code>./</code><code>⟨<i>script-file</i>⟩</code> <code>⟨<i>add</i>⟩</code> |
| 451 |
|
| 452 |
</blockquote> |
| 453 |
</li> |
| 454 |
<li>If you have <strong>several directories</strong> ⟨<i>dir</i>⟩ as before |
| 455 |
of a certain “type”, |
| 456 |
such that they can <strong>share</strong> the settings in |
| 457 |
⟨<i>find-file</i>⟩ and ⟨<i>tex-file</i>⟩, |
| 458 |
you can place the latter in some separate (“central”) |
| 459 |
directory ⟨<i>center</i>⟩ and define an <code><a href="http://en.wikipedia.org/wiki/alias" target="_blank">alias</a></code> |
| 460 |
as follows: |
| 461 |
<blockquote> |
| 462 |
|
| 463 |
<code>alias </code><code>⟨<i>name</i>⟩</code><code>='</code><a href="#call"><code>⟨<i>call</i>⟩</code></a> |
| 464 |
<code>-F </code><code>⟨<i>center</i>⟩</code><code>/</code><code>⟨<i>find-file</i>⟩</code> |
| 465 |
<code>-i </code><code>⟨<i>center</i>⟩</code><code>/</code><code>⟨<i>tex-file</i>⟩</code> |
| 466 |
<code>⟨<i>more</i>⟩</code><code>'</code> |
| 467 |
|
| 468 |
</blockquote> |
| 469 |
(Note that there is no “<code>$@</code>”. |
| 470 |
“<code>⟨<i>dir</i>⟩</code><code>/</code><code>⟨<i>tex-file</i>⟩</code>” could be replaced by |
| 471 |
mere “<code>⟨<i>tex-file</i>⟩</code>” if that ⟨<i>tex-file</i>⟩ |
| 472 |
is installed like a TeX package.) |
| 473 |
<p> |
| 474 |
<strong>Then</strong> you can <strong>vary</strong> additional options/parameters |
| 475 |
⟨<i>add</i>⟩ by |
| 476 |
<blockquote> |
| 477 |
<code>⟨<i>name</i>⟩</code> <code>⟨<i>add</i>⟩</code> |
| 478 |
|
| 479 |
</blockquote> |
| 480 |
</li> |
| 481 |
</ol> |
| 482 |
|
| 483 |
<h2><a name="idea"></a>The idea/motivation; acknowledgements<a href="#idea">.</a></h2> |
| 484 |
One day (most probably 2012-09-27), |
| 485 |
I wanted to check the <code>\ProvideFile</code> contents of <em>two</em> |
| 486 |
files I knew I had edited that day. |
| 487 |
On 2012-09-26, I had thought about simplifying <a href="http://www.ctan.org/pkg/typeoutfileinfo" target="_blank"><span style="font-family:sans-serif">typeoutfileinfo</span></a> |
| 488 |
by using a single command line without any piping. |
| 489 |
I realized that LaTeX s <code>\typeout</code> could be replaced by |
| 490 |
<code>\ReadFileInfos</code> from <a href="http://www.ctan.org/pkg/myfilist" target="_blank"><span style="font-family:sans-serif">myfilist</span></a>. |
| 491 |
Therefore “<a href="http://en.wikipedia.org/wiki/ad hoc" target="_blank">ad hoc</a>”. |
| 492 |
<p> |
| 493 |
Maybe the same day later, |
| 494 |
I realized that I could no longer remember which files I changed that day. |
| 495 |
In July I had discovered <code>$(find ...)</code>. Now I thought that this |
| 496 |
could be used here. “Ad hoc” is less appropriate here, and first I thought |
| 497 |
that there will be different script files for explicitly specified files |
| 498 |
than for applying <span style="font-family:sans-serif">find</span>. |
| 499 |
<p> |
| 500 |
Only then I learnt real shell programming by googling, kind of chance, |
| 501 |
and most helpfully from Chapter 3 of Jürgen Wolfs |
| 502 |
<a href="http://openbook.galileocomputing.de/shell_programmierung" target="_blank">OpenBook</a> |
| 503 |
from <a href="http://de.wikipedia.org/wiki/Galileo Press" target="_blank">Galileo Press</a> |
| 504 |
(<code><a href="http://en.wikipedia.org/wiki/getopts" target="_blank">getopts</a></code> — bad here, however) |
| 505 |
and Prof. Jürgen Plates |
| 506 |
<a href="http://netzmafia.de/skripten/unix/unix8.html" target="_blank">lecture notes</a> |
| 507 |
(“Optionen ermitteln” — “by hand”). |
| 508 |
<p> |
| 509 |
Then quoting/escaping for filename extensions with <span style="font-family:sans-serif"><a href="http://en.wikipedia.org/wiki/find" target="_blank">find</a></span> became difficult … |
| 510 |
Quotation marks and “positional parameters” with the shell are very |
| 511 |
difficult/<strong>painful</strong> — TeX is more straightforward … |
| 512 |
On the other hand it is nice that the entire command line with <em>all</em> the |
| 513 |
“parameters” is gobbled. |
| 514 |
|
| 515 |
<hr> |
| 516 |
<p align="right"><i>Last revised 2013-01-04 © <a href="http://www.webdesign-bu.de/uwe_lueck/contact.html" target="_blank">Uwe Lück</a><br> (using <a href="http://www.ctan.org/pkg/morehype" target="_blank"><span style="font-family:sans-serif">blog.sty</span></a>)<br> License: <a href="http://www.latex-project.org/lppl/" target="_blank">LPPL 1.3c</a> or later, author-maintained.</i></p> |
| 517 |
<p align="right"><a href="#top-of-page">[<i>→ top of page</i> ]</a></p> |
| 518 |
|
| 519 |
<table width="" height="240" border="0" cellpadding="0" cellspacing="0"><tbody> |
| 520 |
<!-- HVspace --> |
| 521 |
<tr valign="top"><td></td> </tr> |
| 522 |
|
| 523 |
</tbody></table> |
| 524 |
|
| 525 |
</body></html> |
| 526 |
|