Debian Codegraph @

texmf-dist/source/latex/rcsinfo/rcsinfo.dtx

raw
1 %\iffalse
2 %<*header>
3
4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 %%
6 %% `rcsinfo' package to use with LaTeX2e.
7 %%
8 %% This package is used to extract the revision and file information provided
9 %% by the RCS revision control system.
10 %% A PERL-package supporting rcsinfo and LaTeX2HTML is provieded too.
11 %%
12 %% Copyright (C) 1995 Dr. Juergen Vollmer
13 %% Viktoriastrasse 15, D-76133 Karlsruhe, Germany
14 %% [email protected]
15 %% License:
16 %% This program can be redistributed and/or modified under the terms
17 %% of the LaTeX Project Public License Distributed from CTAN
18 %% archives in directory macros/latex/base/lppl.txt; either
19 %% version 1 of the License, or any later version.
20 %%
21 %% If you find this software useful, please send me a postcard.
22 %%
23 %% $Id: rcsinfo.dtx,v 1.7 2005/02/25 08:37:03 vollmer draft vollmer $
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25
26 %
27 %\iffalse
28 % to test the checksum, uncomment \OnlyDescription
29 % in the driver
30 %\fi
31 %
32 %% \CheckSum{397}
33 %% \CharacterTable
34 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
35 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
36 %% Digits \0\1\2\3\4\5\6\7\8\9
37 %% Exclamation \! Double quote \" Hash (number) \#
38 %% Dollar \$ Percent \% Ampersand \&
39 %% Acute accent \' Left paren \( Right paren \)
40 %% Asterisk \* Plus \+ Comma \,
41 %% Minus \- Point \. Solidus \/
42 %% Colon \: Semicolon \; Less than \<
43 %% Equals \= Greater than \> Question mark \?
44 %% Commercial at \@ Left bracket \[ Backslash \\
45 %% Right bracket \] Circumflex \^ Underscore \_
46 %% Grave accent \` Left brace \{ Vertical bar \|
47 %% Right brace \} Tilde \~}
48 %</header>
49 %\fi
50
51 % \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs}
52 % \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo}
53 % \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage}
54 % \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage}
55 % \DoNotIndex{\LoadClass,\PassOptionsToClass,\PassOptionsToPackage}
56 % \DoNotIndex{\DeclareOption,\CurrentOption,\ProcessOptions,\ExecuteOptions}
57 % \DoNotIndex{\AtEndOfClass,\AtEndOfPackage,\AtBeginDocument,\AtEndDocument}
58 % \DoNotIndex{\InputIfFileExists,\IfFileExists,\ClassError,\PackageError}
59 % \DoNotIndex{\if,\else,\fi,\emph,\footnotesize,\footrulewidth,\let}
60 % \DoNotIndex{\newcount,\newif,\number,\or,\parindent,\plainfootrulewidth}
61 % \DoNotIndex{\PrintChanges,\PrintIndex,\relax,\setlength,\space}
62 % \DoNotIndex{\the,\textwidth,\thepage,\newcommand,\texttt,\verb,\vfill}
63 % \DoNotIndex{\input,\newpage,\setcounter,\newcounter,\\,\ ,\typeout,\today}
64 %
65 % \MakeShortVerb{\|}
66 % \newcommand{\LatexToHtml}{\LaTeX 2\texttt{HTML}}
67 % \newcommand{\Cmd}[1]{\texttt{$\backslash$#1}}
68 % \newcommand{\RCS}{\emph{RCS}}
69 % \newcommand{\blank}{{\tiny$_\sqcup$}}
70 % \newcommand{\Id}{\texttt{\$Id\$}}
71 % \newcommand{\RcsInfoCmd}[1]{\texttt{$\backslash$rcsInfo\blank\$Id#1\$}}
72 % \changes{v1.1}{1995/08/29}{~\\Initial version}
73 % \changes{v1.2}{1995/08/30}{~\\Changed: README and Make\-file}
74 % \changes{v1.3}{1997/07/07}{~\\New implementation.\\
75 % Support for \LatexToHtml:\\\texttt{rcsinfo.perl}.}
76 % \changes{v1.4}{1998/08/13}{~\\Support for \texttt{facnyhdr} package.\\
77 % Added \texttt{rcsinfo.cfg}.}
78 % \changes{v1.5}{1999/01/22}{~\\Removed autoload of the
79 % \texttt{babel}-package. \\
80 % Fixed the \texttt{notoday} option.}
81 % \changes{v1.6}{1999/02/05}{~\\Fixed problems with changing the catcode of
82 % \texttt{:} (colon), e.g.\ the \texttt{babel}
83 % package with the \texttt{french} option does
84 % this.}
85 % \changes{v1.7}{1999/12/17}{~\\Underscores in file names are now handeled
86 % correctly.}
87 % \changes{v1.7.1}{2000/06/23}{~\\If latex2html is not installed,
88 % \texttt{make} does not abort.}
89 % \changes{v1.8}{2000/07/31}{~\\rcsinfo.perl can deal now with latex2html
90 % version 99.1.\\
91 % Restructured package files.
92 % }
93 % \changes{v1.9}{2002/04/19}{~\\The initial \$ of \$Id may be omitted.}
94 % \changes{v1.10}{2005/02/20}{~\\Added option scrpage2.}
95 % \changes{v1.11}{2005/02/25}{~\\Added option datehyphen.}
96 %
97 % \title{The \texttt{rcsinfo} package}
98 % \author{Dr.~J{\"u}rgen Vollmer\\
99 % Viktoriastra{\ss}e 15\\
100 % D-76133 Karlsruhe, Germany\\
101 % {\footnotesize email: [email protected]}}
102 % \date{February 25, 2005\\Version 1.11}
103 %
104 % \maketitle
105 %
106 % \begin{abstract}
107 % \noindent
108 % This package is used to extract the revision and file information provided
109 % by the \RCS\ revision control system. Support for the \LatexToHtml\
110 % conversion tool is provided\footnote{\LatexToHtml\ is a conversion tool
111 % that allows documents written in \LaTeX\ to become part of the
112 % World Wide Web. It's written by
113 % \emph{Nikos Drakos, Computer Based Learning Unit, University of Leeds.}}
114 % \end{abstract}
115 %
116 %\section{Introduction}
117 %
118 % To maintain different versions of a document or to keep track on the
119 % development of one,
120 % the document is kept under a revison control system like \emph{SCCS} or \RCS.
121 % This package assumes you are using the \RCS\ system.
122 % To present the version information of a document, one needs to extract it
123 % from some kind of text inserted by the revision control system.
124 % \RCS\ offers therefore the \Id\ keyword, which is expanded by the \RCS\
125 % \emph{check out (co)} command and contains a
126 % lot of useful information. This information is made available through
127 % this package.
128 %
129 % The information obtained from the expanded \Id\ string are
130 % \begin{itemize}
131 % \item the filename,
132 % \item the date and time of the last \RCS\ \emph{co} command,
133 % \item the revision number,
134 % \item name of the user who has done this action,
135 % \item the status, and
136 % \item if the file is locked, the name of the locker.
137 % \end{itemize}
138 % For each of these items a macro is defined.
139 % When \emph{checking out} a file, the \RCS\ keywords should be contained in
140 % the \emph{checked out} source.
141 % If the user wishes, the |\today| macro is redefined, so that it returns
142 % the \RCS\ date.
143 %
144 % Many thanks to Thomas M{\"u}ller, aka Howie, who made the first \TeX\ hack
145 % for cracking the \Id\ string\footnote{Thanks to Colin Marquardt
146 % |<[email protected]>| testing the support of the |fancyhdr|
147 % option.}.
148 %
149 % If you want to read about the implementation, put a \% before
150 % |\Only|\-|Description| in the code marked with |<*driver>| in the file
151 % |rcsinfo.dtx|.
152 %
153 %\section{User Interface}
154 %
155 %\subsection{Options}
156 %
157 % Options for this package are:
158 %
159 % \begin{description}
160 % \item[today]
161 % Set the date of |\today| to the date obtained by the \RCS\ information.
162 % If the \Id\ string is not expanded (see below), the current date is
163 % used.
164 % \item[notoday]
165 % Don't use the \RCS\ date for |\today|.
166 % \item[fancy]
167 % We use the \texttt{fancyheadings} package to fill the footline with
168 % \RCS\ information: filename, revision-number, status and date.
169 %
170 % If the \texttt{fancyheadings} package is not already loaded, it
171 % will be loaded
172 % by this package. To use the footnotes, put something like:\\
173 % \hspace*{1em}|\pagestyle{fancyplain}|\\
174 % \hspace*{1em}|\lhead[\fancyplain{}{\leftmark}]{\fancyplain{}{\thepage}}|\\
175 % \hspace*{1em}|\rhead[\fancyplain{}{\thepage}]{\fancyplain{}{\rightmark}}|\\
176 % in the preamble.
177 % \item[fancyhdr]
178 % We use the \texttt{fancyhdr} package to fill the footline with
179 % \RCS\ information: filename, revision-number, status and date.
180 %
181 % If the \texttt{fancyhdr} package is not already loaded, it will be
182 % loaded
183 % by this package. To use the footnotes, put something like:\\
184 % \hspace*{1em}|\pagestyle{fancyplain}|\\
185 % \hspace*{1em}|\fancyhead[RE,LO]{\leftmark}|\\
186 % \hspace*{1em}|\fancyhead[LE,RO]{\thepage}|\\
187 % in the preamble.
188 % \item[nofancy]
189 % We don't define the footline. The \texttt{fancyheadings} /
190 % \texttt{fancyhdr} package is not loaded.
191 % \item[scrpage2]
192 % Use the \texttt{scrpage2} instead of \texttt{fancyhdr}.
193 % Thanks to Marcus Meyer \texttt{<[email protected]>}
194 % for submitting the patch for this option.
195 % \item[long]
196 % If used together with \texttt{fancy} / \texttt{fancyhdr} the date
197 % string is printed in the long format
198 % as |\today| returns it. If \texttt{fancy} / \texttt{fancyhdr}
199 % is not used, nothing.
200 % \item[short]
201 % If used together with \texttt{fancy} / \texttt{fancyhdr} the date
202 % string is printed in the short
203 % format \emph{YYYY/MM/DD}.
204 % If \texttt{fancy} / \texttt{fancyhdr} is not used, nothing.
205 % \item[datehyphen]
206 % Usually the RCS file date has the format YYYY/MM/DD. Sometimes
207 % it is YYYY-MM-DD. The \texttt{datehyphen} switches the package to
208 % accept this date format.
209 % \end{description}
210 % If the \texttt{babel} package is used, the |\today| string is language
211 % dependent.
212 %
213 % The default options are: \emph{today,long}. In the configuration file
214 % |rcsinfo.cfg| one of fancy heading packages may be set as a default
215 % option too.
216 %
217 %\subsection{Commands}
218 %
219 % \subsubsection{Defining the \RCS\ information}
220 %
221 % There is only one macro to define the information:
222 % |\rcsInfo|\DescribeMacro{\rcsInfo}.
223 % Since it must collaborate with \RCS\ it has an ``unusual'' calling sequence:
224 % The arguments are surrouned by \$.
225 % The following arguments are valid:\\
226 % \hspace*{0.5em} \RcsInfoCmd{}\\
227 % \hspace*{0.5em} \RcsInfoCmd{:}\\
228 % \hspace*{0.5em} \RcsInfoCmd{:\blank\emph{file}\texttt{,v}\blank\emph{rev}\blank\emph{YYYY/MM/DD}\blank\emph{hh:mm:ss}\blank\emph{owner}\blank\emph{stat}\blank\emph{lock}\blank}\\
229 % \hspace*{0.5em} \RcsInfoCmd{:\blank\emph{file}\texttt{,v}\blank\emph{rev}\blank\emph{YYYY/MM/DD}\blank\emph{hh:mm:ss}\blank\emph{owner}\blank\emph{stat}\blank}
230 %
231 % In the first two forms, \RCS\ has not expanded the \Id\ string.
232 % This form will usually be used before the file is \emph{checked in}
233 % the first time.
234 %
235 % \emph{YYYY/MM/DD} is a date, \emph{hh:mm:ss} a time.
236 % Note: when you perform the \RCS\ \emph{check out} command, the \Id\ string
237 % is expanded by \RCS\ automatically.
238 %
239 % To take effect, |\rcsInfo| must follow the |\begin{document}|.
240 % If you are using multiple files for a document, you could place
241 % |\rcsInfo| at the
242 % beginning of each file, so the information from the current file is
243 % obtained (this is not valid, when translating with \LatexToHtml, see below).
244 %
245 % \subsubsection{Accessing the \RCS\ information}
246 % There are the following macros to access the information provided by \RCS.
247 % If \RCS\ has not expanded the \Id\ string, or no |\rcsInfo| command is given,
248 % default values are returned.
249 %
250 % \begin{itemize}
251 % \item \DescribeMacro{\rcsInfoFile} The name of the source file, without
252 % the \RCS\ suffix \texttt{,v}.
253 % Default: \texttt{--sourcefile--}.
254 % \item \DescribeMacro{\rcsInfoRevision} The \RCS\ revision number, of the
255 % \emph{checked out} file.
256 % Default: \texttt{--revision--}.
257 % \item \DescribeMacro{\rcsInfoDate} The date in the form \emph{YYYY/MM/DD},
258 % when the file was \emph{checked out}.
259 % Default: the current date.
260 % \item \DescribeMacro{\rcsInfoTime} The time, when the file was
261 % \emph{checked out}.
262 % Default: \texttt{--time--}.
263 % \item \DescribeMacro{\rcsInfoOwner} The user name of the file owner.
264 % Default: \texttt{--owner--}.
265 % \item \DescribeMacro{\rcsInfoStatus} The stautus of the file, e.g.\
266 % \texttt{Exp}.
267 % Default: \texttt{--status--}.
268 % \item \DescribeMacro{\rcsInfoLocker} If the file is locked, the user name
269 % of the locker.
270 % If the file is not locked: \texttt{--not-locked--}.
271 % Default: \texttt{--locker--}.
272 % \item \DescribeMacro{\rcsInfoYear} The year \emph{YYYY} of |\rcsInfoDate|.
273 % Default: the current year.
274 % \item \DescribeMacro{\rcsInfoMonth} The month \emph{MM} of |\rcsInfoDate|.
275 % Default: the current month.
276 % \item \DescribeMacro{\rcsInfoDay} The day \emph{DD} of |\rcsInfoDate|.
277 % Default: the current day.
278 % \item \DescribeMacro{\rcsInfoLongDate} The date in the form of |\today|
279 % when the file was \emph{checked out}. This is language dependend.
280 % Default: the current date.
281 % \end{itemize}
282 %
283 % \subsection{\LatexToHtml}
284 %
285 % When converting a \LaTeX\ document to \texttt{HTML} using the
286 % \LatexToHtml\ tool,
287 % it's possible to use the \RCS\ information in the \texttt{HTML} document too.
288 % This functionality is offered by the extension file \texttt{rcsinfo.perl}
289 % which should be placed into the directory \texttt{LATEX2HTML/styles}.
290 % For more information have a look at the documentation of \LatexToHtml.
291 %
292 % An example is given in the file \texttt{rcsinfo2html.tex}.
293 %
294 % \noindent\underline{Notes}
295 % \begin{itemize}
296 % \item Use at least version \emph{99.1 release (March 30, 1999)} of
297 % \LatexToHtml.
298 %
299 % \item You should |\usepackage{html}|.
300 %
301 % \item You must run \LaTeX\ on the input file before running \LatexToHtml.
302 %
303 % \item In order to make \LatexToHtml\ read the \verb|.aux| file, you must
304 % either:
305 % \begin{itemize}
306 % \item call \LatexToHtml\ with the option
307 % \verb|-show_section_numbers| or
308 % \item include the \verb|.aux| file explicitly in your \LaTeX-source, by
309 % adding the lines in the preamble:\\
310 % \verb|\begin{htmlonly}|\\
311 % \verb|\input{|\emph{source}\verb|.aux}|\\
312 % \verb|\end{htmlonly}|\\
313 % which requires \verb|\usepackage{html}|.
314 % \end{itemize}
315 % If you don't do so, the \verb|\rcsInfo...| commands give no value.
316 %
317 % \item If using the \LatexToHtml\ tool, only the last |\rcsInfo| takes
318 % effect, e.g.~if using several input files each having the |\rcsInfo|
319 % command, only the vales of the last included file are used.
320 % (If this is a serious problem for you, drop me a mail).
321 %
322 % \item If the \verb|fancy| / \verb|fancyhdr| option is given to the
323 % \verb|rcsinfo| package,
324 % the date of the \verb|ADDRESS| at the bottom of the \texttt{HTML}
325 % page is set to the \RCS\ date.
326 %
327 % \item If you would like to set your own \verb|ADDRESS| text, you should
328 % define a procedure, which sets \texttt{perl} \verb|$main::ADDRESS|
329 % variable in your local \texttt{.latex2html} initialization file.
330 % The routine may use the \texttt{perl}
331 % variables shown below. Assign a reference of this procdure to the
332 % \texttt{perl}-variable
333 % \verb|$rcsinfo::SetAddressProc|.
334 % E.g.\ if you have a \texttt{perl} routine \verb|&my_address_field|,
335 % then \\
336 % \verb|$rcsinfo::SetAddressProc = &my_address_field|.
337 % \end{itemize}
338 %
339 % \newcommand{\Var}[1]{\texttt{\$rcsinfo::#1}}
340 % \noindent
341 % Here are the commands, the Perl-variables and their output:\\
342 % \begin{tabular}{lll}
343 % \LaTeX-command & \texttt{perl} variable & Result for this file \\\hline
344 % \verb|\today| & \texttt{\$today} & \today \\
345 % \verb|\rcsInfoFile| & \Var{File} & \rcsInfoFile \\
346 % \verb|\rcsInfoOwner| & \Var{Owner} & \rcsInfoOwner \\
347 % \verb|\rcsInfoStatus| & \Var{Status} & \rcsInfoStatus \\
348 % \verb|\rcsInfoLocker| & \Var{Locker} & \rcsInfoLocker \\
349 % \verb|\rcsInfoDate| & \Var{Date} & \rcsInfoDate \\
350 % \verb|\rcsInfoLongDate| & \Var{LongDate} & \rcsInfoLongDate \\
351 % \verb|\rcsInfoDay| & \Var{Day} & \rcsInfoDay \\
352 % \verb|\rcsInfoMonth| & \Var{Month} & \rcsInfoMonth \\
353 % \verb|\rcsInfoYear| & \Var{Year} & \rcsInfoYear \\
354 % \end{tabular}
355 %
356 % \section{Examples}
357 %
358 % \newcommand{\rcsExample}{
359 % \begin{tabular}[t]{rl}
360 % \Cmd{rcsInfoFile} & \rcsInfoFile \\
361 % \Cmd{rcsInfoRevision} & \rcsInfoRevision \\
362 % \Cmd{rcsInfoDate} & \rcsInfoDate \\
363 % \Cmd{rcsInfoTime} & \rcsInfoTime \\
364 % \Cmd{rcsInfoOwner} & \rcsInfoOwner \\
365 % \Cmd{rcsInfoStatus} & \rcsInfoStatus \\
366 % \Cmd{rcsInfoLocker} & \rcsInfoLocker \\
367 % \end{tabular}
368 % \begin{tabular}[t]{rl}
369 % \Cmd{rcsInfoYear} & \rcsInfoYear \\
370 % \Cmd{rcsInfoMonth} & \rcsInfoMonth \\
371 % \Cmd{rcsInfoDay} & \rcsInfoDay \\
372 % \Cmd{rcsInfoLongDate} & \rcsInfoLongDate \\
373 % \Cmd{today} & \today \\
374 % \end{tabular}\\
375 % \bigskip
376 % \rcsInfo $Id: rcsinfo.dtx,v 1.7 2005/02/25 08:37:03 vollmer draft vollmer $
377 %}
378 %
379 % \rcsInfo $Id$
380 % |\rcsInfo| not expanded, no colon\\
381 % \verb+\rcsInfo $+\verb+Id$+\\
382 % \rcsExample
383 %
384 % \rcsInfo $Id:$
385 % |\rcsInfo| not expanded, having colon\\
386 % \verb+\rcsInfo $+\verb+Id:$+\\
387 % \rcsExample
388 %
389 % \rcsInfo $Id: rcsinfo.dtx,v 1.7 2005/02/25 08:37:03 vollmer draft $
390 % |\rcsInfo| without locker\\
391 % {\small\verb+\rcsInfo $Id: rcsinfo.dtx,v 1.7 2005/02/25 08:37:03 vollmer draft $+}\\
392 % \rcsExample
393 %
394 % \rcsInfo $Id: rcsinfo.dtx,v 1.7 2005/02/25 08:37:03 vollmer draft vollmer $
395 % |\rcsInfo| with locker\\
396 % {\footnotesize\verb+\rcsInfo $Id: rcsinfo.dtx,v 1.7 2005/02/25 08:37:03 vollmer draft vollmer $+}\\
397 % \rcsExample
398 %
399 % \rcsInfo Id: rcsinfo.dtx,v 1.7 2005/02/25 08:37:03 vollmer draft vollmer $
400 % |\rcsInfo| no leading \$\\
401 % {\footnotesize\verb+\rcsInfo Id: rcsinfo.dtx,v 1.7 2005/02/25 08:37:03 vollmer draft vollmer $+}\\
402 % \rcsExample
403 %
404 % \section{Copyright and License}
405 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
406 %
407 % \begin{tabular}{ll}
408 % Copyright (\copyright) 1995, & Dr.~J\"urgen Vollmer, Karlsruhe, Germany\\
409 % & \texttt{[email protected]} \\
410 % \end{tabular}
411 %
412 % \noindent
413 % This program can be redistributed and/or modified under the terms
414 % of the \LaTeX Project Public License Distributed from CTAN
415 % archives in directory 'macros/latex/base/lppl.txt'; either
416 % version 1 of the License, or any later version.
417 %
418 % \medskip\noindent
419 % If you find this software useful, please send me a postcard.
420 %
421 % \StopEventually{}
422 %
423 % \section{The Documentation Driver File}
424 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
425 %
426 % The next bit of code contains the documentation driver file for
427 % \TeX\, i.e., the file that will produce the documentation you are
428 % currently reading. It will be extracted from this file by the
429 % \texttt{docstrip} program.
430 %
431 % If you want to read about the implementation, put a \% before
432 % |\OnlyDescription| in the following code.
433 % \begin{macrocode}
434 %<*driver>
435 \documentclass{article}
436 \usepackage{doc}
437 \usepackage{rcsinfo}
438 \OnlyDescription
439 \makeatletter
440 \if@rcsInfoUseFancy@
441 \pagestyle{fancyplain}
442 \rhead[\fancyplain{}{\leftmark}]{\fancyplain{}{\thepage}}
443 \lhead[\fancyplain{}{\thepage}]{\fancyplain{}{\rightmark}}
444 \fi
445 \if@rcsInfoUseFancyhdr@
446 \pagestyle{fancyplain}
447 \fancyhead[RE,LO]{\leftmark}
448 \fancyhead[LE,RO]{\thepage}
449 \fi
450 \makeatother
451 \RecordChanges
452 \EnableCrossrefs
453 \CodelineIndex
454 \begin{document}
455 \DocInput{rcsinfo.dtx}
456 \PrintChanges
457 \setcounter{IndexColumns}{2}
458 \PrintIndex
459 \end{document}
460 %</driver>
461 % \end{macrocode}
462 %
463 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
464 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
465 %
466 % \section{The Configuration File}
467 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
468 %
469 % You can set up the default fancy headings package in the file
470 % |rcsinfo.cfg|.
471 % Use the old |fancyheadings| package or the new |fancyhdr| package,
472 % by setting the corresponding default option: |fancy| or |fancyhdr|.
473 % \begin{macrocode}
474 %<*config>
475 \ExecuteOptions{fancyhdr}
476 %</config>
477 % \end{macrocode}
478 %
479 %
480 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
481 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
482 %
483 % \section{The Implementation}
484 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%
485 %
486 % The implementation is based on cracking the \Id\ string. To support
487 % \LatexToHtml\ some macro definitions are written to the |.aux| file.
488 % These macros are the used by \LatexToHtml\ and |rcsinfo.perl| to extract
489 % the \RCS\ info.
490 %
491 % What do we need, and who we are:
492 % \begin{macrocode}
493 %<*package>
494 \NeedsTeXFormat{LaTeX2e}
495 \ProvidesPackage{rcsinfo}[2005/02/20 v1.10]
496 % \end{macrocode}
497 %
498 % Declare some local counters to store the \RCS\ date
499 % \begin{macrocode}
500 \newcount\@rcsInfoDay
501 \newcount\@rcsInfoMonth
502 \newcount\@rcsInfoYear
503 % \end{macrocode}
504 % Declare some local counters to hold some temporary information
505 % \begin{macrocode}
506 \newcount\@rcsInfoYearTmp
507 \newcount\@rcsInfoMonthTmp
508 \newcount\@rcsInfoDayTmp
509 % \end{macrocode}
510 %
511 % To memorize, that we want to set |\today| to the date obtained by the
512 % \RCS\ information.
513 % \begin{macrocode}
514 \newif\if@rcsInfoToday@
515 % \end{macrocode}
516 %
517 % |\today| should return the date obtained by the \RCS\ information.
518 % \begin{macrocode}
519 \DeclareOption{today}{
520 \@rcsInfoToday@true
521 }
522 % \end{macrocode}
523 %
524 % Ok we don't want do use it.
525 % \begin{macrocode}
526 \DeclareOption{notoday}{
527 \@rcsInfoToday@false
528 }
529 % \end{macrocode}
530 %
531 % To memorize, that we want to have the old \texttt{fancyheadings}, the new
532 % \texttt{fancyhdr}, or \texttt{srcpage2} footline filled with \RCS\
533 % information.
534 % \begin{macrocode}
535 \newif\if@rcsInfoUseFancy@
536 \newif\if@rcsInfoUseFancyhdr@
537 \newif\if@rcsInfoUseScrpage@
538 % \end{macrocode}
539 %
540 % We want to use the old \texttt{fancyheadings} or the new \texttt{fancyhdr}
541 % package, and set the footline with the \RCS\ information.
542 % Only one option may be in effect.
543 % \begin{macrocode}
544 \DeclareOption{fancy}{
545 \@rcsInfoUseFancy@true
546 \@rcsInfoUseFancyhdr@false
547 \@rcsInfoUseScrpage@false
548 }
549 \DeclareOption{fancyhdr}{
550 \@rcsInfoUseFancy@false
551 \@rcsInfoUseFancyhdr@true
552 \@rcsInfoUseScrpage@false
553 }
554 \DeclareOption{scrpage2}{
555 \@rcsInfoUseFancy@false
556 \@rcsInfoUseFancyhdr@false
557 \@rcsInfoUseScrpage@true
558 }
559 % \end{macrocode}
560 %
561 % Ok we don't want do use it.
562 % \begin{macrocode}
563 \DeclareOption{nofancy}{
564 \@rcsInfoUseFancy@false
565 \@rcsInfoUseFancyhdr@false
566 \@rcsInfoUseScrpage@false
567 }
568 % \end{macrocode}
569 %
570 % To memorize, that we want to use the long date format.
571 % \begin{macrocode}
572 \newif\if@rcsInfoLong@
573 % \end{macrocode}
574 %
575 % We want to use the long date format.
576 % \begin{macrocode}
577 \DeclareOption{long}{
578 \@rcsInfoLong@true
579 }
580 % \end{macrocode}
581 %
582 % Ok we don't want do use it.
583 % \begin{macrocode}
584 \DeclareOption{short}{
585 \@rcsInfoLong@false
586 }
587 % \end{macrocode}
588 %
589 %
590 % To memorize, that we want to use the date format with hypens.
591 % \begin{macrocode}
592 \newif\if@rcsInfoDateHyphen@
593 \DeclareOption{datehyphen}{
594 \@rcsInfoDateHyphen@true
595 }
596 % \end{macrocode}
597 %
598 % Use these default options,
599 % \begin{macrocode}
600 \ExecuteOptions{today,long}
601 % \end{macrocode}
602 %
603 % read the configuration file, to set the default fancy headings package,
604 % \begin{macrocode}
605 \IfFileExists{rcsinfo.cfg}{\input{rcsinfo.cfg}}{}
606 % \end{macrocode}
607 %
608 % and the process the user options.
609 % \begin{macrocode}
610 \ProcessOptions
611 % \end{macrocode}
612 % Load \texttt{fancyheadings} / \texttt{fancyhdr} if neccessary.
613 % \begin{macrocode}
614 \if@rcsInfoUseFancy@
615 \RequirePackage{fancyheadings}
616 \fi
617 \if@rcsInfoUseFancyhdr@
618 \RequirePackage{fancyhdr}
619 \fi
620 \if@rcsInfoUseScrpage@
621 \RequirePackage{scrpage2}
622 \fi
623 % \end{macrocode}
624 %
625 % If no language for the |babel| package is given in the document,
626 % we have to redefine |\today| (otherwise the changed |\year|, |\month| and
627 % |\day| won't work). In this case use the english version of |\today|.
628 % \begin{macrocode}
629 \def\today{\ifcase\month\or
630 January\or February\or March\or April\or May\or June\or
631 July\or August\or September\or October\or November\or December\fi
632 \space\number\day, \number\year}
633 % \end{macrocode}
634 %
635 % We have a problem, since the number of arguments of |\rcsInfo| vary from
636 % zero to seven.
637 % To deal with that, we use some kind ``contuinuation passing'' style of
638 % programming.
639 % |\@rcsInfoNext| contains the action to be done next.
640 %
641 % Some packages (e.g.\ the |babel|-package with the |french|-option)
642 % change the catcode of |:| (colon). If this happens, we have to
643 % undo this in order to parse the \Id\ string (which contains a colon)
644 % and restore its original catcode afterwards.
645 % This flag is used to store whether the state of the colon was changed to
646 % be active.
647 % \begin{macrocode}
648 \newif\if@rcsInfoColonIsActive@
649 % \end{macrocode}
650
651 %\begin{macro}{\rcsInfo}
652 % Extract the \RCS\ information, and give commands shown above their values.
653 % Check the catcode of |:| and set the flag. The restoration is done after the
654 % |:| has been read. Allow \_ (underscore) in file names, hence change the
655 % |\catcode| of it.
656 % \begin{macrocode}
657 \def\rcsInfo {
658 \catcode`\_=13
659 \ifnum\catcode`\:=13
660 \@rcsInfoColonIsActive@true
661 \catcode`:=12
662 \else
663 \@rcsInfoColonIsActive@false
664 \fi
665 \@rcsInfoReadArgs
666 }
667 % \end{macrocode}
668 %\end{macro}
669
670 %\begin{macro}{\@rcsInfoReadArgs}
671 % First check, if the \Id\ string is not-expanded.
672 % Set the default values, so that for not expanded \Id\ strings, we get them.
673 % The \$ before |Id| may be omitted (I use this to avoid expansion of
674 % \$Id-Tags to be expanded by RCS in some cases).
675 % Restore the catcode of the |:|.
676 % \begin{macrocode}
677 \def\@rcsInfoReadArgs #1Id#2 {
678 \@rcsInfoDefaults
679 \if $#2 \let \@rcsInfoNext = \@rcsInfoEat
680 \else \let \@rcsInfoNext = \@rcsInfoEatColon
681 \fi
682 % \end{macrocode}
683 % |#2| contains either |$| or |:$| or |:|\blank\ hence we have read the colon
684 % and can restore the catode of it.
685 % \begin{macrocode}
686 \if@rcsInfoColonIsActive@
687 \catcode`:=13
688 \fi
689 % \end{macrocode}
690 % Start processing the \Id\ string.
691 % \begin{macrocode}
692 \@rcsInfoNext $Id#2
693 }
694 % \end{macrocode}
695 %\end{macro}
696
697 %\begin{macro}{\@rcsInfoEat}
698 % This macro eats up its argument, i.e.\ removes it from the input.
699 % Reset the |\catcode| of the underscore.
700 % \begin{macrocode}
701 \def\@rcsInfoEat #1 {\catcode`\_=8}
702 % \end{macrocode}
703 %\end{macro}
704
705 %\begin{macro}{\@rcsInfoEatColon}
706 % This macro eats up the colon following \texttt{Id}.
707 % The colon may be followed by a \$, which means that the \Id\ string is not
708 % expanded.
709 % \begin{macrocode}
710 \def\@rcsInfoEatColon $Id:#1 {
711 \if $#1 \let \@rcsInfoNext = \@rcsInfoEat
712 \else \let \@rcsInfoNext = \@rcsInfoCrackAndEat
713 \fi
714 \@rcsInfoNext #1
715 }
716 % \end{macrocode}
717 %\end{macro}
718
719 %\begin{macro}{\@rcsInfoCrackAndEat}
720 % Take an expanded \Id\ string pass it to the crack routine
721 % |\@rcsInfoCrack|\-|String|, which specifies what has to be done
722 % after it. I.e.\ if we have no locker, we have already eaten the \$,
723 % if we have a locker, we still have to eat the terminating \$.
724 % Note: here we don't give an argument to |\@rcsInfoNext|, since it is taken
725 % form the source, in case of |\@rcsInfoEat|.
726 % We have to take the next 7 tokens.
727 % \begin{macrocode}
728 \def\@rcsInfoCrackAndEat #1,v #2 #3 #4 #5 #6 #7 {
729 \@rcsInfoCrackString #1,v #2 #3 #4 #5 #6 #7
730 \@rcsInfoNext
731 }
732 % \end{macrocode}
733 %\end{macro}
734
735 %\begin{macro}{\@rcsInfoCrackString}
736 % Take an expanded \Id\ string and crack it:\\
737 % \#1: filename, \#2 revision, \#3 date, \#4 time, \#5 owner, \#6 status,
738 % \#7 locker\\
739 % Hence we have to consume the terminating \$ afterwards, or \\
740 % \#1: filename,\#2 revision, \#3 date, \#4 time, \#5 owner, \#6 status,
741 % \#7 \$ \\
742 % Here we have already consumed the terminating \$ as 7$^{th}$ parameter, hence
743 % |\relax|. Reset the |\catcode| of the underscore.
744 %
745 % Split the date into year,month and day.
746 % If the option \texttt{today} is given, |\today| returns from now
747 % on the \RCS\ date.
748 %
749 % Write some macro definitions to the |.aux| file, to support \LatexToHtml.
750 % \begin{macrocode}
751 \def\@rcsInfoCrackString #1,v #2 #3 #4 #5 #6 #7 {
752 \def\rcsInfoFile{#1}
753 \def\rcsInfoRevision{#2}
754 \def\rcsInfoTime{#4}
755 \def\rcsInfoOwner{#5}
756 \def\rcsInfoStatus{#6}
757 \write\@mainaux{\string\def\string\rcsInfoFILE{#1}}
758 \write\@mainaux{\string\def\string\rcsInfoREVISION{#2}}
759 \write\@mainaux{\string\def\string\rcsInfoTIME{#4}}
760 \write\@mainaux{\string\def\string\rcsInfoOWNER{#5}}
761 \write\@mainaux{\string\def\string\rcsInfoSTATUS{#6}}
762
763 \if $#7
764 \def\rcsInfoLocker{--not-locked--}
765 \write\@mainaux{\string\def\string\rcsInfoLocker{--not-locked--}}
766 \let \@rcsInfoNext = \relax
767 \else
768 \def\rcsInfoLocker{#7}
769 \write\@mainaux{\string\def\string\rcsInfoLocker{#7}}
770 \let \@rcsInfoNext = \@rcsInfoEat
771 \fi
772 \catcode`\_=8
773 \@rcsInfoSplitDate x#3x
774 \def\rcsInfoLongDate{\@rcsInfoToday}
775 \if@rcsInfoToday@
776 \year = \@rcsInfoYear
777 \month = \@rcsInfoMonth
778 \day = \@rcsInfoDay
779 \fi
780 }
781 % \end{macrocode}
782 %\end{macro}
783 %
784 %\begin{macro}{\@rcsInfoSplitDate}
785 % This macro sets |\rcsInfoYear|, |\rcsInfoMonth|, and |\rcsInfoDay|.
786 % The default is to take a \texttt{x}\emph{YYYY/MM/DD}\texttt{x} style of
787 % argument.
788 % If the |datehyphen| option is given, we accept
789 % \texttt{x}\emph{YYYY-MM-DD}\texttt{x} as argument.
790 % \begin{macrocode}
791 \if@rcsInfoDateHyphen@
792 \def\@rcsInfoSplitDate x#1-#2-#3x{
793 \@rcsInfoDay = #3
794 \@rcsInfoMonth= #2
795 \@rcsInfoYear = #1
796 \write\@mainaux{\string\def\string\rcsInfoDAY{#3}}
797 \write\@mainaux{\string\def\string\rcsInfoMONTH{#2}}
798 \write\@mainaux{\string\def\string\rcsInfoYEAR{#1}}
799 }
800 \else
801 \def\@rcsInfoSplitDate x#1/#2/#3x{
802 \@rcsInfoDay = #3
803 \@rcsInfoMonth= #2
804 \@rcsInfoYear = #1
805 \write\@mainaux{\string\def\string\rcsInfoDAY{#3}}
806 \write\@mainaux{\string\def\string\rcsInfoMONTH{#2}}
807 \write\@mainaux{\string\def\string\rcsInfoYEAR{#1}}
808 }
809 \fi
810 % \end{macrocode}
811 %\end{macro}
812 %
813 %\begin{macro}{\@rcsInfoToday}
814 % Returns the \RCS\ date in the form as |\today| does it.
815 % To do this, we set |\year|, |\month| and |\day| commands to the
816 % corresponding \RCS\ information, let |\today| does its work, i.e.\
817 % transforming the date into a language dependent string and reset
818 % |\year|, |\month| and |\day| to their previous value.
819 %
820 % \begin{macrocode}
821 \def\@rcsInfoToday {%
822 \@rcsInfoYearTmp = \year
823 \@rcsInfoMonthTmp = \month
824 \@rcsInfoDayTmp = \day
825 \year = \@rcsInfoYear
826 \month = \@rcsInfoMonth
827 \day = \@rcsInfoDay
828 \today%
829 \year = \@rcsInfoYearTmp
830 \month = \@rcsInfoMonthTmp
831 \day = \@rcsInfoDayTmp
832 }
833 % \end{macrocode}
834 %\end{macro}
835 %
836 %\begin{macro}{\@rcsInfoDefaults}
837 % This macro sets the default values.
838 % \begin{macrocode}
839 \def\@rcsInfoDefaults {
840 \@rcsInfoYear = \year
841 \@rcsInfoMonth = \month
842 \@rcsInfoDay = \day
843 \def\rcsInfoFile{--sourcefile--}
844 \def\rcsInfoDate{\the\@rcsInfoYear/\two@digits\@rcsInfoMonth/%
845 \two@digits\@rcsInfoDay}
846 \def\rcsInfoTime{--time--}
847 \def\rcsInfoRevision{--revision--}
848 \def\rcsInfoOwner{--owner--}
849 \def\rcsInfoStatus{--status--}
850 \def\rcsInfoLocker{--locker--}
851 \def\rcsInfoYear{\the\@rcsInfoYear}
852 \def\rcsInfoMonth{\the\@rcsInfoMonth}
853 \def\rcsInfoDay{\the\@rcsInfoDay}
854 \def\rcsInfoLongDate{\@rcsInfoToday}
855 }
856 % \end{macrocode}
857 %\end{macro}
858 %
859 %\begin{macro}{\@rcsInfoFancyFoot}
860 % This defines the contents of the footline
861 % \begin{macrocode}
862 \def\@rcsInfoFancyFoot {
863 \if@rcsInfoLong@
864 \def\@rcsInfoFancyInfo{{\footnotesize%
865 \emph{Rev: \rcsInfoRevision,
866 \rcsInfoStatus,
867 \rcsInfoLongDate}}}
868 \else
869 \def\@rcsInfoFancyInfo{{\footnotesize%
870 \emph{Rev: \rcsInfoRevision,
871 \rcsInfoStatus,
872 \rcsInfoDate}}}
873 \fi
874 \def\@rcsInfoFancyFile{{\footnotesize\emph{\rcsInfoFile}}}
875 % \end{macrocode}
876 % and set it for the \texttt{fancyheadings} package,
877 % package page style.
878 % \begin{macrocode}
879 \if@rcsInfoUseFancy@
880 \rfoot[\fancyplain{\@rcsInfoFancyFile}{\@rcsInfoFancyFile}]%
881 {\fancyplain{\@rcsInfoFancyInfo}{\@rcsInfoFancyInfo}}
882 \lfoot[\fancyplain{\@rcsInfoFancyInfo}{\@rcsInfoFancyInfo}]%
883 {\fancyplain{\@rcsInfoFancyFile}{\@rcsInfoFancyFile}}
884 \setlength{\footrulewidth}{0.4pt}
885 \setlength{\plainfootrulewidth}{0.4pt}
886 \fi
887 % \end{macrocode}
888 % for the \texttt{fancyhdr} package,
889 % \begin{macrocode}
890 \if@rcsInfoUseFancyhdr@
891 \fancyfoot[LE,RO]{\@rcsInfoFancyInfo}
892 \fancyfoot[LO,RE]{\@rcsInfoFancyFile}
893 \fancyfoot[CO,CE]{\thepage}
894 \renewcommand{\footrulewidth}{0.4pt}
895 \fancypagestyle{plain}{%
896 \fancyfoot[LE,RO]{\@rcsInfoFancyInfo}
897 \fancyfoot[LO,RE]{\@rcsInfoFancyFile}
898 \fancyfoot[CO,CE]{\thepage}
899 \renewcommand{\footrulewidth}{0.4pt}
900 }
901 \fi
902 % \end{macrocode}
903 %\end{macro}
904 % for the \texttt{srcpage2} package,
905 % \begin{macrocode}
906 \if@rcsInfoUseScrpage@
907 \clearscrheadfoot
908 \ohead{\headmark}
909 \cfoot[\emph{\@rcsInfoFancyInfo}]{\emph{\@rcsInfoFancyInfo}}
910 \ifoot[\@rcsInfoFancyFile]{\@rcsInfoFancyFile}
911 \ofoot[\pagemark]{\pagemark}
912 \pagestyle{scrheadings}
913 \fi
914 }
915 % \end{macrocode}
916 %\end{macro}
917
918 % Initialize the defaults
919 % \begin{macrocode}
920 \@rcsInfoDefaults
921 % \end{macrocode}
922
923 % At the start of the document, if we use the
924 % \texttt{fancyheadings} / \texttt{fancyhdr} / \texttt{srcpage2} footline,
925 % we should set it here.
926 % \begin{macrocode}
927 \AtBeginDocument{
928 \if@rcsInfoUseFancy@
929 \@rcsInfoFancyFoot
930 \fi
931 \if@rcsInfoUseFancyhdr@
932 \@rcsInfoFancyFoot
933 \fi
934 \if@rcsInfoUseScrpage@
935 \@rcsInfoFancyFoot
936 \fi
937 }
938 %</package>
939 % \end{macrocode}
940 % \centerline{That's the end}
941 %
942 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
943 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
944 %
945 % \Finale
946 %
947 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
948 % \iffalse
949 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
950 %
951 % The following stuff does not show up in the documentation of the package:
952 %
953 % rcsinfo2html.tex: the example file for transforming to HTML
954 %
955 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
956 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
957 %
958 %<*html>
959 \documentclass{article}
960 \usepackage{html}
961 \usepackage{rcsinfo}
962
963 % the rcsinfo.perl stuff needs that the .aux file has been read!
964 \begin{htmlonly}
965 \input{rcsinfo2html.aux}
966 \end{htmlonly}
967
968 \newcommand{\LatexToHtml}{\LaTeX 2\texttt{HTML}}
969 \newcommand{\Var}[1]{\texttt{\$rcsinfo::#1}}
970 \newcommand{\RCS}{\emph{RCS}}
971
972 \pagestyle{fancy}
973
974 \begin{document}
975 \rcsInfo $Id: rcsinfo.dtx,v 1.7 2005/02/25 08:37:03 vollmer draft vollmer $
976
977 \author{Dr.~J{\"u}rgen Vollmer\\
978 Viktoriastra{\ss}e 15, D-76133 Karlruhe, Germany\\
979 \small{\texttt{[email protected]}}}
980 \date{\today}
981 \title{Example for converting a \LaTeX\ document to \texttt{HTML}\\
982 using \LatexToHtml\ and the \texttt{rcsinfo}-package}
983 \maketitle
984
985 \section{Notes}
986 %%%%%%%%%%%%%%%
987
988 \begin{itemize}
989 \item Use at least version \emph{99.1 release (March 30, 1999)} of
990 \LatexToHtml.
991
992 \item You should \verb|\usepackage{html}|.
993
994 \item You must run \LaTeX\ on the input file before running \LatexToHtml.
995
996 \item In order to make \LatexToHtml\ read the \verb|.aux| file, you must
997 either:
998 \begin{itemize}
999 \item call \LatexToHtml\ with the option
1000 \verb|-show_section_numbers| or
1001 \item include the \verb|.aux| file explicitly in your \LaTeX-source, by
1002 adding the lines in the preamble:\\
1003 \verb|\begin{|\verb|htmlonly}|\\ % looks ulgy, but otherwise
1004 \verb|\input{|\emph{source}\verb|.aux}|\\
1005 \verb|\end{|\verb|htmlonly}|\\ % latex2html fails.
1006 which requires \verb|\usepackage{html}|.
1007 \end{itemize}
1008 If you don't do so, the \verb|\rcsInfo...| commands give no value.
1009
1010 \item If using the \LatexToHtml\ tool, only the last \verb|\rcsInfo| takes
1011 effect, e.g.~if using several input files each having the \verb|\rcsInfo|
1012 command, only the vales of the last included file are used.
1013 (If this is a serious problem for you, drop me a mail).
1014
1015 \item If the \verb|fancy| / \verb|fancyhdr| option is given to the
1016 \verb|rcsinfo| package,
1017 the date of the \verb|ADDRESS| at the bottom of the \texttt{HTML}
1018 page is set to the \RCS\ date.
1019
1020 \item If you would like to set your own \verb|ADDRESS| text, you should
1021 define a procedure, which sets \texttt{perl} \verb|$main::ADDRESS|
1022 variable in your local \texttt{.latex2html} initialization file.
1023 The routine may use the \texttt{perl}
1024 variables shown below. Assign a reference of this procdure to the
1025 \texttt{perl}-variable
1026 \verb|$rcsinfo::SetAddressProc|.
1027 E.g.\ if you have a \texttt{perl} routine \verb|&my_address_field|,
1028 then \\
1029 \verb|$rcsinfo::SetAddressProc = &my_address_field|.
1030
1031 For example the follownig \texttt{perl}-code does the job:
1032 \begin{verbatim}
1033 sub my_address_field
1034 {
1035 $ADDRESS = '<hr>This file was last updated on ' .
1036 $rcsinfo::Date .
1037 '&nbsp; by ' .
1038 '<a href="mailto: [email protected]">' .
1039 'Dr. Juergen Vollmer ' .
1040 '&lt;[email protected]&gt;</a>';
1041 }
1042 $rcsinfo::SetAddressProc = \&my_address_field;
1043 \end{verbatim}
1044 \end{itemize}
1045
1046 \newpage
1047
1048 \section{Example}
1049 %%%%%%%%%%%%%%%%%
1050
1051 \label{sec-examples}
1052 Here are the commands and their output:
1053
1054 \begin{tabular}{lll}
1055 \LaTeX-command & \texttt{perl} variable & Result for this file \\\hline
1056 \verb|\today| & \texttt{\$today} & \today \\
1057 \verb|\rcsInfoFile| & \Var{File} & \rcsInfoFile \\
1058 \verb|\rcsInfoOwner| & \Var{Owner} & \rcsInfoOwner \\
1059 \verb|\rcsInfoStatus| & \Var{Status} & \rcsInfoStatus \\
1060 \verb|\rcsInfoLocker| & \Var{Locker} & \rcsInfoLocker \\
1061 \verb|\rcsInfoDate| & \Var{Date} & \rcsInfoDate \\
1062 \verb|\rcsInfoLongDate| & \Var{LongDate} & \rcsInfoLongDate \\
1063 \verb|\rcsInfoDay| & \Var{Day} & \rcsInfoDay \\
1064 \verb|\rcsInfoMonth| & \Var{Month} & \rcsInfoMonth \\
1065 \verb|\rcsInfoYear| & \Var{Year} & \rcsInfoYear \\
1066 \end{tabular}
1067
1068 \end{document}
1069 %</html>
1070 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1071 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1072 %
1073 % The following stuff does not show up in the documentation of the package:
1074 % rcsinfo.ins
1075 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1076 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1077 %<*ins>
1078 \def\batchfile{rcsinfo.ins}
1079 \input docstrip.tex
1080
1081 \Msg{}
1082 \Msg{***********************************************************}
1083 \Msg{** Hello to the installation of the `rcsinfo' package.}
1084 \Msg{** Version 1.11, February 25, 2005}
1085 \Msg{***********************************************************}
1086 \Msg{}
1087
1088 \generate{
1089 \askforoverwritefalse
1090 %\file{rcsinfo.ins}{\from{rcsinfo.dtx}{header,ins}}
1091 \file{rcsinfo.cfg}{\from{rcsinfo.dtx}{header,config}}
1092 \file{rcsinfo.sty}{\from{rcsinfo.dtx}{header,package}}
1093 \file{rcsinfo2html.tex}{\from{rcsinfo.dtx}{header,html}}
1094 \usepreamble\empty
1095 \usepostamble\empty
1096 \file{rcsinfo.perl}{\from{rcsinfo.dtx}{perl}}
1097 \file{rcsinfo.init}{\from{rcsinfo.dtx}{init}}
1098 }
1099
1100 \Msg{}
1101 \Msg{***********************************************************}
1102 \Msg{** Edit the file rcsinfo.cfg and set the default fancy headings package}
1103 \Msg{** To finish the installation move the file `rcsinfo.sty' and}
1104 \Msg{** rcsinfo.cfg to a place where LaTeX will find it.}
1105 \Msg{** To Get the documentation: `latex rcsinfo.dtx'}
1106 \Msg{** and `latex rcsinfo2html.dtx'}
1107 \Msg{** If you are using LaTeX2HTML, move the PERL-package}
1108 \Msg{** `rcsinfo.perl' to a place where LaTeX2HTML will find it.}
1109 \Msg{** `rcsinfo.perl' is created by running `latex rcsinfo.dtx'.}
1110 \Msg{** Happy TeXing}
1111 \Msg{***********************************************************}
1112 \Msg{}
1113 %</ins>
1114 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1115 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1116 %
1117 % The following stuff does not show up in the documentation of the package:
1118 % rcsinfo.perl
1119 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1120 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1121 %<*perl>
1122 ###############################################################################
1123 # RCSINFO.PERL
1124 # Copyright 1995, Dr. Juergen Vollmer <[email protected]>
1125 #
1126 # Extension to LaTeX2HTML to translate LaTeX commands of the
1127 # rcsinfo
1128 # package to equivalent HTML commands.
1129 #
1130 # This is file `rcsinfo.perl',
1131 # generated with the docstrip utility.
1132 #
1133 # The original source files were:
1134 #
1135 # rcsinfo.dtx (with options: `perl')
1136 #
1137 # IMPORTANT NOTICE:
1138 #
1139 # For the copyright see the source file.
1140 #
1141 # Any modified versions of this file must be renamed
1142 # with new filenames distinct from rcsinfo.perl.
1143 #
1144 # For distribution of the original source see the terms
1145 # for copying and modification in the file rcsinfo.dtx.
1146 #
1147 # This generated file may be distributed as long as the
1148 # original source files, as listed above, are part of the
1149 # same distribution. (The sources need not necessarily be
1150 # in the same archive or directory.)
1151 #
1152 # $Id: rcsinfo.dtx,v 1.7 2005/02/25 08:37:03 vollmer draft vollmer $
1153 #
1154 ###############################################################################
1155
1156 package rcsinfo;
1157
1158 ($Dummy1,$PackageVersionDate,$PackageVersionTime,$Dummy2) =
1159 split (/ /,'$Date: 2005/02/25 08:37:03 $');
1160
1161 print "\n\t rcsinfo style interface for LaTeX2HTML, $PackageVersionDate\n";
1162
1163 # set defaults options
1164 $OptionFancy = 1;
1165 $OptionToday = 1;
1166 $OptionLong = 1;
1167
1168 # set default values
1169 $Date = `date '+%Y/%m/%d'`;
1170 $Time = `date '+%H:%M:%S'`;
1171 $File = "--sourcefile--";
1172 $Revision = "--revision--";
1173 $Owner = "--owner--";
1174 $Status = "--status--";
1175 $Locker = "--locker--";
1176 $Year = `date '+%Y'`;
1177 $Month = `date '+%m'`;
1178 $Day = `date '+%d'`;
1179 $LongDate = $Date;
1180
1181 sub SetAddress
1182 {
1183 $main::address_data[1] = "Revision: $rcsinfo::Revision, $rcsinfo::LongDate";
1184 # Supply your own string if you don't like the default <Name> <Date>
1185 $main::ADDRESS = "<I>$main::address_data[0] <BR>\n$main::address_data[1]</I>";
1186 }
1187 if ($SetAddressProc == "") {
1188 $SetAddressProc = \&rcsinfo::SetAddress;
1189 }
1190 sub make_cmds
1191 {
1192 my $cmd;
1193 foreach $cmd (File,Revision,Date,Time,Owner,Status,Locker,Year,Month,Day,LongDate) {
1194 eval "sub main::do_cmd_rcsInfo$cmd { "
1195 . 'my $val = $rcsinfo::' . "$cmd; "
1196 # . 'printf STDERR "\ndo_cmd_rcsInfo%s=%s\n", ' . $cmd .', $val;'
1197 . "join('',\$val,\$_[0]);"
1198 . "}";
1199 }
1200 }
1201
1202 @GermanMonthName = ('','Januar','Februar','M&auml;rz','April','Mai','Juni','Juli',
1203 'August','September','Oktober','November','Dezember');
1204 @EnglishMonthName = ('','January','February','March','April','May','June','July',
1205 'August','September','October','November','December');
1206 @FrenchMonthName = ('','Janvier','F&eacute;vrier','Mars','Avril','Mai','Juin',
1207 'Juillet','Ao&ucirc;t','Septembre','Octobre','Novembre',
1208 'D&eacute;cembre');
1209
1210 ###############################################################################
1211
1212 package main;
1213
1214 # handling package options
1215 sub do_rcsinfo_fancyhdr { $rcsinfo::OptionFancy = 1; }
1216 sub do_rcsinfo_fancy { $rcsinfo::OptionFancy = 1; }
1217 sub do_rcsinfo_nofancy { $rcsinfo::OptionFancy = 0; }
1218 sub do_rcsinfo_today { $rcsinfo::OptionToday = 1; }
1219 sub do_rcsinfo_notoday { $rcsinfo::OptionToday = 0; }
1220 sub do_rcsinfo_short { $rcsinfo::OptionLong = 0; }
1221 sub do_rcsinfo_long { $rcsinfo::OptionLong = 1; }
1222 sub do_rcsinfo_datehyphen { } # nothing just ignore it
1223
1224 # handling of LaTeX commands
1225 sub do_cmd_rcsInfo
1226 {
1227
1228 local ($_) = @_;
1229
1230 # printf STDERR "\ndo_cmd_rcsInfo\n";
1231
1232 # see latex2html, procedure: substitute_meta_cmds, process_body_newcommand
1233 # the format of the variable $new_command{cmd} is:
1234 # $new_command{$cmd} = join(':!:',$argn,$body,$opt);
1235 # note: opt = "}" means: Flag for no optional arg
1236 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoFILE};
1237 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoREVISION};
1238 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoYEAR};
1239 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoMONTH};
1240 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoDAY};
1241 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoTIME};
1242 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoOWNER};
1243 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoSTATUS};
1244 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoLOCKER};
1245
1246 # the following assumes: LaTeX2HTML Version 99.1 release (March 30, 1999)
1247 # may be later
1248 my ($argn, $opt);
1249 if (exists $new_command{rcsInfoFILE}) {
1250 ($argn, $rcsinfo::File, $opt) = split(/:!:/, $new_command{rcsInfoFILE});
1251 } else {
1252 $rcsinfo::File = $File
1253 }
1254 if (exists $new_command{rcsInfoREVISION}) {
1255 ($argn, $rcsinfo::Revision, $opt) = split(/:!:/, $new_command{rcsInfoREVISION});
1256 } else {
1257 $rcsinfo::Revision = $Revision
1258 }
1259 if (exists $new_command{rcsInfoYEAR}) {
1260 ($argn, $rcsinfo::Year, $opt) = split(/:!:/, $new_command{rcsInfoYEAR});
1261 } else {
1262 $rcsinfo::Year = $Year
1263 }
1264 if (exists $new_command{rcsInfoMONTH}) {
1265 ($argn, $rcsinfo::Month, $opt) = split(/:!:/, $new_command{rcsInfoMONTH});
1266 } else {
1267 $rcsinfo::Month = $Month
1268 }
1269 if (exists $new_command{rcsInfoDAY}) {
1270 ($argn, $rcsinfo::Day, $opt) = split(/:!:/, $new_command{rcsInfoDAY});
1271 } else {
1272 $rcsinfo::Day = $Day
1273 }
1274 if (exists $new_command{rcsInfoTIME}) {
1275 ($argn, $rcsinfo::Time, $opt) = split(/:!:/, $new_command{rcsInfoTIME});
1276 } else {
1277 $rcsinfo::Time = $Time
1278 }
1279 if (exists $new_command{rcsInfoOWNER}) {
1280 ($argn, $rcsinfo::Owner, $opt) = split(/:!:/, $new_command{rcsInfoOWNER});
1281 } else {
1282 $rcsinfo::Owner = $Owner
1283 }
1284 if (exists $new_command{rcsInfoSTATUS}) {
1285 ($argn, $rcsinfo::Status, $opt) = split(/:!:/, $new_command{rcsInfoSTATUS});
1286 } else {
1287 $rcsinfo::Status = $Status
1288 }
1289 if (exists $new_command{rcsInfoLOCKER}) {
1290 ($argn, $rcsinfo::Locker, $opt) = split(/:!:/, $new_command{rcsInfoLOCKER});
1291 } else {
1292 $rcsinfo::Locker = $Locker
1293 }
1294
1295 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::File;
1296 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::Revision;
1297 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::Year;
1298 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::Month;
1299 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::Day;
1300 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::Time;
1301 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::Owner;
1302 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::Status;
1303 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::Locker;
1304
1305 # the following code is for oldfashioned latex2hmtl, not anymore supported
1306 # format of $_:
1307 # vvvvvv that's text following the RCS-Id-string
1308 # <#nr#>.....<#nr>......
1309 # ^ ^ ^ that's the RCS-Id-string
1310 # my ($Nr,$IdString,$Rest) = /(<#\d+#>)(.*)\1(.*)/s ;
1311
1312 # The Id-String may contain various tags, remove them
1313 # $IdString =~ s/<[^>]*>//g;
1314
1315 # The Id-String may contain various tags, remove them
1316 # $IdString =~ s/<[^>]*>//g;
1317
1318 # split the Id-string
1319 # my ($id,$file,$revision,$date,$time,$owner,$status,$locker) = split(/\s/,$IdString);
1320
1321 # remove trailing ,v
1322 # $file =~ s/,v$//;
1323
1324 # split date
1325 # ($rcsinfo::Year,$rcsinfo::Month,$rcsinfo::Day) = split (/[\-]//,$date);
1326
1327 # $rcsinfo::Revision = $revision;
1328 # $rcsinfo::File = $file;
1329 # $rcsinfo::Date = $date;
1330 # $rcsinfo::Time = $time;
1331 # $rcsinfo::Owner = $owner;
1332 # $rcsinfo::Status = $status;
1333 # $rcsinfo::Locker = $locker;
1334
1335 if ($default_language eq 'german' || $default_language eq 'austrian') {
1336 $rcsinfo::LongDate = $rcsinfo::Day . '.&nbsp;' .
1337 $rcsinfo::GermanMonthName[$rcsinfo::Month] . '&nbsp;' .
1338 $rcsinfo::Year;
1339 $rcsInfo::Date = $rcsinfo::Day . '.&nbsp;' . $rcsinfo::Month . '.&nbsp;' . $rcsinfo::Year;
1340 } elsif ($default_language eq 'french') {
1341 $rcsinfo::LongDate = $rcsinfo::Day . '.&nbsp;' .
1342 $rcsinfo::FrenchMonthName[$rcsinfo::Month] . '&nbsp;' .
1343 $rcsinfo::Year;
1344 $rcsInfo::Date = $rcsinfo::Day . '.&nbsp;' .$rcsinfo::Month . '.&nbsp;' . $rcsinfo::Year;
1345 } else { # english is the default
1346 $rcsinfo::LongDate = $rcsinfo::EnglishMonthName[$rcsinfo::Month] . '&nbsp;' .
1347 $rcsinfo::Day . ',&nbsp;' .
1348 $rcsinfo::Year;
1349 $rcsInfo::Date = $rcsinfo::Year . '/' .$rcsinfo::Month . '/' . $rcsinfo::Day;
1350 }
1351
1352 if ($rcsinfo::OptionFancy == 1) {
1353 &$rcsinfo::SetAddressProc;
1354 }
1355 rcsinfo::make_cmds();
1356
1357 # printf STDERR "xxx $HTML_VERSION, $HTML_OPTIONS\n";
1358 # remove stuff generated for the $Id: rcsinfo.dtx,v 1.7 2005/02/25 08:37:03 vollmer draft vollmer $-string
1359 # we assume that noting follows the "\rcsInfo $Id....$"
1360 if ($HTML_VERSION >= 3.2) {
1361 /^<tex2html_verbatim_mark>[^\n]*/;
1362 return $';
1363 } elsif ($HTML_VERSION == 3.1 || $HTML_VERSION == 2.1) {
1364 /^<tex2html_image_mark>[^\n]*/;
1365 return $';
1366 } else {
1367 if ($HTML_OPTIONS =~ /math/) {
1368 /^<tex2html_verbatim_mark>[^\n]*/;
1369 return $';
1370 } else {
1371 /^<tex2html_image_mark>[^\n]*/;
1372 return $';
1373 }
1374 }
1375 }
1376
1377 # Replace do_cmd_today (\today) using the RCS date.
1378 sub do_cmd_today {
1379 local($today);
1380 if ($rcsinfo::OptionToday == 1) {
1381 $today = $rcsinfo::LongDate;
1382 } else {
1383 if ($default_language eq 'german' || $default_language eq 'austrian') {
1384 $today = (`date "+%m:%d, 20%y"`);
1385 $today =~ s/(\d{1,2}):0?(\d{1,2}),/$2. $rcsinfo::GermanMonthName[$1]/o;
1386 $today =~ s/20([7|8|9]\d{1})/19$1/o;
1387 } elsif ($default_language eq 'french') {
1388 $today = (`date "+%m:%d, 20%y"`);
1389 $today =~ s/(\d{1,2}):0?(\d{1,2}),/$2 $rcsinfo::FrenchMonthName[$1]/o;
1390 $today =~ s/20([7|8|9]\d{1})/19$1/o;
1391 } else { # english is the default
1392 $today = (`date "+%m:%d, 20%y"`);
1393 $today =~ s/(\d{1,2}):0?/$rcsinfo::EnglishMonthName[$1] /o;
1394 $today =~ s/20([7|8|9]\d{1})/19$1/o;
1395 }
1396 }
1397 join('',$today,$_[0]);
1398 }
1399
1400 1;
1401
1402 ###############################################################################
1403 %</perl>
1404 %
1405 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1406 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1407 %
1408 % The following stuff does not show up in the documentation of the package:
1409 % latex2html.init
1410 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1411 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1412 %
1413 %<*init>
1414 # This is file `rcsinfo.init',
1415 # generated with the docstrip utility.
1416 #
1417 # The original source files were:
1418 #
1419 # rcsinfo.dtx (with options: `init')
1420 #
1421 # IMPORTANT NOTICE:
1422 #
1423 # For the copyright see the source file.
1424 #
1425 # Any modified versions of this file must be renamed
1426 # with new filenames distinct from rcsinfo.init.
1427 #
1428 # For distribution of the original source see the terms
1429 # for copying and modification in the file rcsinfo.dtx.
1430 #
1431 # This generated file may be distributed as long as the
1432 # original source files, as listed above, are part of the
1433 # same distribution. (The sources need not necessarily be
1434 # in the same archive or directory.)
1435 #
1436 # This file should be used as initialization file for LaTeX2HTML
1437 # when transforming rcsinfo2html.tex --> HTML
1438 #
1439 # $Id: rcsinfo.dtx,v 1.7 2005/02/25 08:37:03 vollmer draft vollmer $
1440 ###############################################################################
1441 sub my_address_field
1442 {
1443 $ADDRESS = '<hr>This file was last updated on ' .
1444 $rcsinfo::Date .
1445 '&nbsp; by ' .
1446 '<a href="mailto: [email protected]">' .
1447 'Dr. Juergen Vollmer ' .
1448 '&lt;[email protected]&gt;</a>';
1449 }
1450 $rcsinfo::SetAddressProc = \&my_address_field;
1451 ###############################################################################
1452 %</init>
1453 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1454 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1455 % E N D of R C S I N F O . D T X
1456 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1457 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1458 %\fi