Debian Codegraph @

texmf-dist/doc/latex/getfiledate/getfiledate-guide.tex

raw
1 %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
2 % This is file getfiledate-guide.tex, the documentation for the getfiledate %
3 % package. %
4 % %
5 % (c) Ahmed Musa 2009 %
6 %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
7 \documentclass[a4paper,11pt,final]{article}
8 \usepackage[scaled=0.9]{helvet}
9 \usepackage{mathpazo}
10 \usepackage{getfiledate}
11 \usepackage[left=3.5cm,right=3.5cm,top=3.5cm,bottom=3.5cm]{geometry}
12 \usepackage{fancyvrb,shortvrb}
13 \usepackage{array,colortbl}
14 \usepackage{multicol}
15 \usepackage{parskip}
16 \usepackage{xspace}
17 \usepackage{fancyhdr}
18 \usepackage{lastpage}
19 \usepackage{ltablex}
20 \keepXColumns
21 \usepackage{hyperref}
22 \usepackage{doipubmed}
23 \new\let\TC\textcolor
24 \xglobal\definecolorset{rgb}{x}{0}{green1,0.00,0.59,0.00;%
25 green2,0.84,0.84,0.00;blue1,0.50,0.00,1.00;magenta1,0.50,0.00,0.50;%
26 magenta2,0.50,0.00,1.00}
27 \hypersetup{colorlinks=true,linkcolor=red,pdfpagemode=UseThumbs,
28 implicit=true,breaklinks=true,citecolor=purple,pdfview=FitH,
29 pdfstartview=FitH}
30 \CustomVerbatimEnvironment{gfdverbatim}{Verbatim}{numbers=left,
31 numberblanklines=false,firstnumber=last,frame=single,
32 rulecolor=\color{orange},framerule=2pt,
33 framesep=2pt,fillcolor=\color{violet!55},formatcom=\color{xmagenta20},
34 xrightmargin=0pc,commandchars=\|\(\),commentchar=\?}
35 \new\def\stya#1{\TC{xgreen10}{\texttt{#1}}}
36 \new\def\styb#1{\TC{teal}{\texttt{#1}}}
37 \new\def\cmda#1{\stya{\string#1}}
38 \new\def\cmdb#1{\styb{\string#1}}
39 \new\def\cmdc#1{\stya{#1\string\hsize}}
40 \newcommand*\email[1]{\href{mailto:#1}{#1}}
41 \def\ie{i.e.\xspace}
42 \newcounter{examplecnt}[section]
43 \new\def\gfdexample{%
44 \refstepcounter{examplecnt}
45 \endgraf\vspace*{.5\baselineskip}%
46 \TC{purple}{\textbf{Example~\thesection.\theexamplecnt}}%
47 \endgraf\nobreak
48 }
49 \date{\TC{purple}{\today}\vadjust{\kern2ex\hrule}}
50 \new\def\helv{\fontfamily{phv}\selectfont\color{xmagenta10}}
51 \def\eg{e.g.\xspace}
52 \def\ie{i.e.\xspace}
53 \def\etc{etc.\xspace}
54 \fancyhf{}
55 \fancyhfoffset[R,L]{\dimexpr\marginparsep+\marginparwidth}
56 \lhead{\helv The \texttt{\TC{blue}{getfiledate}} Package}
57 \rhead{\helv Page~\thepage~of~\pageref*{LastPage}}
58 \renew\def\headrule{\color{blue}\hrule height1pt width\headwidth\relax
59 \vspace{2pt}\hrule height1pt width\headwidth\vspace{-2pt}}
60 \renew\def\footrule{\color{green}\hrule height1pt width\headwidth\relax
61 \vspace{2pt}\hrule height1pt width\headwidth\vspace{2pt}}
62 \pagestyle{fancyplain}
63
64 \begin{document}
65 \MakeShortVerb{\+}
66 \title{{\bfseries The \TC{blue}{\texttt{getfiledate}} Package}\\[1ex]
67 Version 1.2}
68 \author{Ahmed Musa\\[.5ex]University of Central Lancashire\\
69 Preston, United Kingdom\\[1ex]\email{[email protected]}
70 }
71 \maketitle
72
73 \columnseprule=0.5pt\premulticols=2cm
74 \begin{multicols}{2}
75 \small\tableofcontents\normalsize
76 \end{multicols}
77 \bigskip
78
79 \begin{center}
80 \fboxsep3pt\fboxrule2.5pt
81 \fcolorbox{red}{yellow}{\fcolorbox{xmagenta20}{gray!15}{%
82 \parbox{\dimexpr\hsize-4\fboxsep-4\fboxrule}{%
83 \hfil\fcolorbox{cyan}{white}{\hspace{1cm}\textbf{Summary}\hspace{1cm}}\hfill\\[.5ex]
84 The \stya{getfiledate} package fetches from the system the date of last modification or opening of a resident file. It is based on an idea by Heiko Oberdiek \citeurl{[email protected]} that appeared in February 2009 on the discussion/newsgroup website \url{comp.text.tex}, namely, using the \cmda{\pdffilemoddate} command of pdf\TeX. This package creates a user-friendly interface for obtaining and presenting the needed filedate in several formats.
85 }}}
86 \end{center}
87
88 \section{User interface}
89 The package may be loaded without options as in
90 \begin{gfdverbatim}
91 \usepackage{getfiledate}
92 \end{gfdverbatim}
93 or with options as in
94 \begin{gfdverbatim}
95 \usepackage[option=value]{getfiledate}
96 \end{gfdverbatim}
97 The options include the filename for which you want to print the date of last modification. The options and their default values are described in section~\ref{sec:PackageOptions}. It is advisable to first load the package by \cmda{\usepackage\{getfiledate\}} and then use the macro \cmda{\getfiledate} to dynamically determine and print the date of last modification of filenames. The \cmda{\getfiledate} macro sets the various options. The \cmdb{\documentclass} and \cmda{\usepackage\{getfiledate\}} options lists may, however, be used to set options that apply throughout the document.
98
99 \section{Package options\label{sec:PackageOptions}}
100 The package options are listed in Table~\ref{tab:Package-options} below.
101
102 \begingroup
103 \small
104 \rowcolors{3}{yellow!20}{gray!25}
105 \extrarowheight2pt
106 \begin{tabularx}{\linewidth}{m{3cm}m{3.5cm}X}
107 \caption{Package options\label{tab:Package-options}}\\
108 \rowcolor{green!55}
109 \bf Option & \bf Default & \bf Meaning\\
110 \endfirsthead
111 \multicolumn{3}{l}{\emph{Continued from last page}}\\
112 \bf Option & \bf Default & \bf Meaning\\
113 \endhead
114 \multicolumn{3}{r}{\emph{Continued on next page}}\\
115 \endfoot
116 \endlastfoot
117 +file+ & +getfiledate.sty+ & The file for which the date of last modification is required.\\
118 +prefix+ & The date of last modification of file & The prefix of filename.\\
119 +postfix+ & +was+ & The postfix of filename, not that of filedate. It has been necessary to provide both prefix and postfix following user requests.\\
120 +width+ & +\hsize+ & The width of the parbox or boxedminipage containing the filedate.\\
121 +head+ & +0ex+ & The vertical separation between the paragraph before the filedate and the filedate itself. When this option is passed to package without value, its default becomes the +\baselineskip+.\\
122 +foot+ & +0ex+ & The vertical skip between the filedate's line and the paragraph after filedate. When this option is passed to package without value, its default becomes the +\baselineskip+.\\
123 +marker+ & +\empty+ & The mark before the filename, on the same line with the filedate.\\
124 +markercolor+ & +blue+ & The color of the marker.\\
125 +filenamecolor+ & +blue+ & The color of the filename.\\
126 +datecolor+ & +blue+ & The color of filedate.\\
127 +inlinespace+ & +1em+ & The horizontal separation between the marker and the filedate.\\
128 +separator+ & +\textbullet+ & The marker between the filedate and filetime.\\
129 +sepcolor+ & +black+ & The color of the separator.\\
130 +framecolor+ & +black+ & The color of the boxrule for the boxedminipage.\\
131 +framesep+ & +3pt+ & The +\fboxsep+ for the boxedminipage.\\
132 +framerule+ & +0.4pt+ & The +\fboxrule+ for the boxedminipage.\\
133 +align+ & +justified+ & Alignment of the boxedminipage (possible values are \stya{center}, \stya{left}, \stya{right} and \stya{justified}).\\
134 +putprefix+ & +true+ & The boolean switch for placing prefix and postfix before the filedate. If this option is not entered in the call to \cmda{\getfiledate}, or if it is entered as \stya{putprefix=true}, both prefix and postfix will be inserted. On the other hand, if the user sets \stya{putprefix=false}, then no prefix and postfix will be inserted (even if the user specifies prefix and postfix in the call to \cmda{\getfiledate}). This option has been necessitated by users who just want to get filedate without any prefix, postfix or filename.\\
135 +notime+ & +false+ & The boolean switch for turning the display of time on or off.\\
136 +boxed+ & +false+ & The boolean switch for enclosing the filedate in a box. If the user simply enters this option without value, it will be assumed to be +true+. If it doesn't appear in the options list, its value is +false+.
137 \end{tabularx}
138 \endgroup
139
140 \section{Examples}
141 \gfdexample
142
143 The simplest example is to use the \cmda{\getfiledate} macro in the following way:
144 \begin{gfdverbatim}
145 \getfiledate[putprefix]{dir/filename.ext}
146 \end{gfdverbatim}
147 for which the default values of the package options will be used. For the sample file \styb{misc-test1.tex}, the outcome of this will be:
148
149 \small
150 \getfiledate{misc-test1.tex}
151 \normalsize
152
153 \bigskip
154 The prefix and postfix can be turned off as follows:
155
156 \begin{gfdverbatim}
157 \getfiledate[putprefix=false]{dir/filename.ext}
158 \end{gfdverbatim}
159
160 which gives
161
162 \small
163 \getfiledate[putprefix=false]{misc-test1.tex}
164 \normalsize
165
166 \bigskip
167 If the user needs the prefix and postfix in subsequent calls to \cmda{\getfiledate}, he has to turn them on again---through \stya{putprefix} as follows. Once turned on, they remain in effect until switched off later.
168
169 The setting
170 \begin{gfdverbatim}
171 \getfiledate[putprefix,marker={$\star$}]{dir/filename.ext}
172 \end{gfdverbatim}
173
174 gives
175
176 \small
177 \getfiledate[putprefix,marker={$\star$}]{misc-test1.tex}
178 \normalsize
179
180 \bigskip
181 The ability to change both the prefix and postfix automatically provides a +babel+ (\ie, multilingual) support. For example, if I want the postfix to be \cmdb{\mrule}, I can simply enter
182
183 \begin{gfdverbatim}
184 \new\def\mrule{\rule[.2ex]{.5cm}{3pt}}
185 \getfiledate[putprefix,marker={$\star$},
186 postfix=\mrule]{dir/filename.ext}
187 \end{gfdverbatim}
188
189 to get
190
191 \new\def\mrule{\rule[.2ex]{.5cm}{3pt}}
192 \small
193 \getfiledate[putprefix,marker={$\star$},postfix=\mrule]{misc-test1.tex}
194 \normalsize
195
196 \bigskip
197 You can use all package options to customize the format of the result. The following examples illustrate the most important issues in using this package.
198
199 \gfdexample
200 The example in this section was obtained with the following settings. There are values specified for \stya{head} and \stya{foot}.
201 \begin{gfdverbatim}
202 \getfiledate[putprefix,postfix,head=.1\baselineskip,
203 foot=2\baselineskip,markercolor=magenta,
204 filenamecolor=purple,datecolor=orange,
205 inlinespace=.5em,marker=$\blacktriangleright$,separator
206 ]{misc-test1.tex}
207 \end{gfdverbatim}
208
209 The outcome of this is
210 \small
211 \getfiledate[putprefix,postfix,
212 head=.1\baselineskip,foot=2\baselineskip,
213 markercolor=magenta,filenamecolor=purple,datecolor=orange,
214 inlinespace=.5em,marker=$\blacktriangleright$,separator
215 ]{misc-test1.tex}
216 \normalsize
217
218 If you don't need the \stya{marker}, you can simply enter \stya{marker} without value as follows
219
220 \begin{gfdverbatim}
221 \getfiledate[head=\baselineskip,
222 foot=\baselineskip,width=.6\hsize,filenamecolor=xgreen10,
223 prefix=The date of final changes to file,
224 datecolor=orange,inlinespace=.5em,boxed=false,
225 separator=$\spadesuit$,sepcolor=green,|color(red)marker|color(xmagenta20),align=center
226 ]{misc-test1.tex}
227 \end{gfdverbatim}
228
229 to get
230
231 \getfiledate[head=\baselineskip,
232 foot=\baselineskip,width=.6\hsize,
233 prefix=The date of final changes to file,
234 marker,filenamecolor=xgreen10,datecolor=orange,
235 inlinespace=1em,align=center,boxed=false,
236 separator=$\spadesuit$,sepcolor=green
237 ]{misc-test1.tex}
238
239 If you simply remove \stya{marker} from the key-value list, the \stya{marker} will retain the last value you assigned to it rather than the default value (which is nil).
240
241 \gfdexample
242
243 Unlike the case of the \stya{marker}, if you don't need the \stya{separator}, you would have to enter \stya{separator=\{\}} or simply \stya{separator=} as follows
244
245 \begin{gfdverbatim}
246 \getfiledate[head=\baselineskip,foot=\baselineskip,
247 width=.6\hsize,filenamecolor=xgreen10,
248 prefix=The date of final changes to file,
249 datecolor=orange,inlinespace=.5em,boxed=false,
250 |color(red)separator=,|color(xmagenta20)sepcolor=green,marker,align=center
251 ]{misc-test1.tex}
252 \end{gfdverbatim}
253
254 to get
255
256 \getfiledate[head=\baselineskip,
257 foot=\baselineskip,width=.6\hsize,
258 prefix=The date of final changes to file,
259 marker,filenamecolor=xgreen10,datecolor=orange,
260 inlinespace=2em,align=center,boxed=false,
261 separator=,sepcolor=green
262 ]{misc-test1.tex}
263
264 The same trick can be applied to some other keys. If you simply remove the \stya{separator} from the key-value list, the \stya{separator} will retain the last value you assigned to it rather than the default value (which is \cmda{\textbullet}). If in the subsequent calls to \cmda{\getfiledate}, you need the \stya{separator}, you would have to specify it or (to use the default value) simply enter \stya{separator} without value.
265
266 \textbf{Notes}: The user should note the following:
267 \begin{itemize}
268 \item The inclusion of the \stya{width} (\cmdc{0.6}) in the above example. The \stya{width} will maintain this value until it is changed again, as in the following examples.
269
270 \item If you enter \stya{putprefix=false} and you want the outcome centered, you should remember to set the right \stya{width}. For example, the following will not be centered, simply because the value of \stya{width} is \cmdc{0.8}:
271
272 \begin{gfdverbatim}
273 \getfiledate[putprefix=false,align=center,
274 width=0.8\hsize,separator]{dir/filename.ext}
275 \end{gfdverbatim}
276
277 which gives
278
279 \getfiledate[putprefix=false,align=center,width=0.8\hsize,separator]{misc-test1.tex}
280
281 Setting \cmdc{width=.3} gives the desired result:
282
283 \getfiledate[putprefix=false,align=center,width=0.3\hsize,separator]{misc-test1.tex}
284
285 \item The assignment to keys can be localized by enclosing the \cmda{\getfiledate} command in a group (\eg, \cmdb{\bgroup} ... \cmdb{\egroup}).
286
287 \item The change of \stya{prefix} here. The default value of \stya{prefix} is \stya{The date of last modification of file}. The \stya{prefix} will maintain this value until it is changed in the next call (see the next example).
288 \item The ability to change the \stya{prefix} and \stya{postfix} provides a babel (\ie, multilingual) support, since the user can specify suitable values of these keys.
289
290 \item The use of the key-value \stya{align=center} above. The key \stya{align} can assume values of \stya{center}, \stya{left}, \stya{right}, and \stya{justified}. Any other value for \stya{align} will be rejected by the package.
291 \item Some of the package options (\eg, \stya{putprefix}, \stya{notime}) can be submitted globally via the options list of \cmdb{\documentclass}.
292 \end{itemize}
293
294 \gfdexample
295 The example in this section was obtained with the following settings:
296 \begin{gfdverbatim}
297 \getfiledate[head=0ex,foot=\baselineskip,
298 prefix,width=\hsize,markercolor=magenta,filenamecolor=red,
299 datecolor=violet,inlinespace=.5em,marker=$\triangleright$,
300 separator=$\clubsuit$,sepcolor=xbgreen1
301 ]{misc-test2.tex}
302 \end{gfdverbatim}
303
304 The outcome is:
305 \getfiledate[head=0ex,
306 foot=1ex,width=\hsize,prefix,
307 markercolor=magenta,filenamecolor=red,datecolor=violet,
308 inlinespace=.5em,marker=$\triangleright$,
309 separator=$\clubsuit$,sepcolor=red!55!green!65
310 ]{misc-test2.tex}
311 Here we simply passed the \stya{prefix} without value so that its default value was used.
312
313 \gfdexample
314 The example in this section was obtained with the following settings:
315 \begin{gfdverbatim}
316 \getfiledate[head=\baselineskip,foot=\baselineskip,
317 markercolor=red!65,filenamecolor=blue,
318 datecolor=orange,inlinespace=.5em,marker={$\star$},
319 separator=$\Diamond$,sepcolor=red
320 ]{misc-test3.tex}
321 \end{gfdverbatim}
322
323 The outcome is:
324 \getfiledate[head=\baselineskip,
325 foot=\baselineskip,markercolor=red!65,filenamecolor=blue,
326 datecolor=orange,inlinespace=.5em,marker={$\star$},
327 separator=$\Diamond$,sepcolor=red
328 ]{misc-test3.tex}
329
330 \gfdexample
331
332 The example in this section was obtained with the following settings:
333 \begin{gfdverbatim}
334 \getfiledate[head=\baselineskip,foot=2ex,
335 filenamecolor=blue,datecolor=orange,
336 inlinespace=.5em,marker={$\blacktriangleright$},
337 markercolor=cyan,separator=$\heartsuit$,sepcolor
338 ]{misc-test4.tex}|color(black) % Use default sepcolor
339 \end{gfdverbatim}
340
341 The outcome is:
342 \getfiledate[head=\baselineskip,foot=2ex,
343 markercolor=cyan,filenamecolor=blue,datecolor=orange,
344 inlinespace=.5em,marker={$\blacktriangleright$},
345 separator=$\heartsuit$,sepcolor
346 ]{misc-test4.tex}
347
348 \gfdexample
349 The example in this section was obtained with the following settings:
350 \begin{gfdverbatim}
351 \getfiledate[head=1ex,foot=1ex,
352 markercolor=purple,filenamecolor=blue,
353 datecolor=orange,inlinespace=.5em,
354 marker={$\blacktriangleright$},separator={}
355 ]{misc-test5.tex}|color(black) % The separator is nil here.
356 \end{gfdverbatim}
357
358 The outcome of this is:
359 \getfiledate[head=1ex,foot=1ex,
360 markercolor=purple,filenamecolor=blue,datecolor=orange,
361 inlinespace=.5em,marker={$\blacktriangleright$},
362 separator={}
363 ]{misc-test5.tex}
364
365 \gfdexample
366 Instead of keeping \stya{head} and \stya{foot}, you may instead decide to frame your result, as follows:
367 \begin{gfdverbatim}
368 \getfiledate[head=.5\baselineskip,
369 foot=.5\baselineskip,width=12.5cm,framesep=5pt,framerule=.4pt,
370 align=center,markercolor=purple,filenamecolor=blue,
371 datecolor=orange,marker={$\blacktriangleright$},
372 separator=$\heartsuit$,boxed
373 ]{misc-test5.tex}|color(black) % marker has no effect here.
374 \end{gfdverbatim}
375
376 The outcome is:
377 \getfiledate[head=.5\baselineskip,foot=.5\baselineskip,
378 width=12.5cm,framesep=3pt,framerule=.4pt,align=center,
379 markercolor=purple,filenamecolor=blue,datecolor=orange,
380 marker={$\blacktriangleright$},separator=$\heartsuit$,
381 boxed
382 ]{misc-test5.tex}
383
384 The boolean option \stya{boxed} has the default value of \stya{true} when listed in the key-value list. If you set the key \stya{boxed(=true)} in one call to the \cmda{\getfiledate} macro, and you don't want the filedate to be boxed subsequently, you have to turn it off (\ie, enter \stya{boxed=false}) in the next call to \cmda{\getfiledate}. The choice \stya{boxed(=true)} automatically turns off \stya{marker} irrespective of whether or not you have submitted a value to this key in \cmda{\getfiledate} macro. In the above example, the reader will notice that the setting \stya{marker=\string\blacktriangleright} has no effect on the outcome.
385
386 For the boxed filedates, you can set the options \stya{framesep} and \stya{framerule} (equivalents of \LaTeX's native \cmdb{\fboxsep} and \cmdb{\fboxrule}) as follows:
387 \begin{gfdverbatim}
388 \getfiledate[head=\baselineskip,
389 foot=1ex,marker={$\blacktriangleright$},markercolor=purple,
390 filenamecolor=blue,width=.9\hsize,datecolor=orange,
391 inlinespace=.5em,align=left,boxed,separator=$\blacklozenge$,
392 |color(red)framesep=5pt,framerule=2pt|color(xmagenta20)
393 ]{misc-test5.tex} |color(black) % marker has no effect here.
394 \end{gfdverbatim}
395
396 The outcome of this is:
397 \getfiledate[head=\baselineskip,foot=1ex,
398 markercolor=purple,filenamecolor=blue,datecolor=orange,
399 inlinespace=.5em,marker={$\blacktriangleright$},width=.9\hsize,
400 align=left,boxed,framesep=5pt,framerule=2pt,separator=$\blacklozenge$
401 ]{misc-test5.tex}
402
403 The default values of \stya{framesep} and \stya{framerule} are 3pt and 0.4pt (\LaTeX's native values for \cmdb{\fboxsep} and \cmdb{\fboxrule}). The user should note that the keys \stya{framesep} and \stya{framerule} should, of course, be submitted without backslashes (\eg, \stya{framesep=5pt} and \stya{framerule=2pt}).
404
405 You can change the box frame color as in
406 \begin{gfdverbatim}
407 \getfiledate[head=\baselineskip,
408 foot=\baselineskip,markercolor=purple,filenamecolor=blue,
409 datecolor=orange,width=8cm,align=right,boxed,framesep=5pt,
410 framerule=2pt,separator=$\Diamond$,|color(red)framecolor=green|color(xmagenta20)
411 ]{misc-test5.tex}
412 \end{gfdverbatim}
413
414 The outcome of this is:
415 \getfiledate[head=\baselineskip,foot=\baselineskip,
416 markercolor=purple,filenamecolor=blue,datecolor=orange,width=8cm,
417 inlinespace=.5em,marker={$\blacktriangleright$},align=right,
418 boxed,framesep=5pt,framerule=2pt,separator=$\Diamond$,
419 framecolor=green
420 ]{misc-test5.tex}
421
422 This frame color will remain in force until it is changed again. The default value of \stya{framecolor} is \stya{black}.
423
424 \gfdexample
425
426 The display of time can be avoided by using the switch \stya{notime}, as follows.
427 \begin{gfdverbatim}
428 \getfiledate[notime,head=\baselineskip,foot=1ex,
429 markercolor=purple,filenamecolor=blue,datecolor=orange,
430 inlinespace=.5em,marker={$\blacktriangleright$},width=.8\hsize,
431 align=center,boxed,framecolor=olive!25
432 ]{misc-test5.tex}
433 \end{gfdverbatim}
434
435 The outcome of this is:
436 \getfiledate[notime,head=\baselineskip,foot=1ex,
437 markercolor=purple,filenamecolor=blue,datecolor=orange,
438 inlinespace=.5em,marker={$\blacktriangleright$},width=.8\hsize,
439 align=center,boxed,framecolor=olive!25
440 ]{misc-test5.tex}
441
442 Notice here that the immediate past values of \stya{framerule} and \stya{framesep} are still in effective.
443
444 \section{Postamble}
445 The record of filedates can be logged in a file (say, \cmdb{\jobname.fds}), but I haven't encountered a real need for it.
446
447 \end{document}