% Dated footer style (for LaTeX2e) % This style redefines the empty, plain and headers pagestyles to include a % date stamp in the footer. % % The date is the current date, or optionally from the date string from a % revision control system (rcs) keyword string. The user can directly set the % date stamp value using the macro \datestamp. The default form for the date % is "1996/08/02". % % options: % all (default) - The date stamp is placed on all pages. % first - The date stamp is placed only on the first page of the main % document, and on the first page of any \included files. % off - The date stamp is turned off. This option suppresses printing of % the date stamp without the need to remove all datestamp commands (such % as \rcs). % % The datestamp value can be controlled with the \datestamp macro. % \datestamp [datestamp-string] - Set the date stamp value, overriding the % current date or date derived from the \rcs macro. If the optional % datestamp-string is omitted, the current date is used. % % Files under rcs control: % For a file under rcs control is that the date stamp that appears on the % document is the time of the document modification and not that of the time % of printing. To use the rcs date, the user invokes the \rcs macro which % takes as an argument an rcs keyword string. The date is taken from the % rcs keyword string only if the keyword string indicates that the file is % checked in, i.e. not checked out by rcs for modification. % % This style defines the macro \rcs. The user places a revision control % system (rcs) keyword string in the source file at a point after this % package is invoked. % \rcs{#Id: #} % Use "$" instead of "#"; the example has to use # % % instead of $ to avoid having rcs place the % % keyword string in the text of the example. % The Id keyword string is replaced by rcs with one of the following form. % \rcs{$Id: datestamp.sty,v 1.12 1997/08/26 13:01:47 kabal Exp $} % % Included files: % For each file invoked with "\include", the date stamp is reset to the % current date. An "\rcs" command in the included file can be used to % change the date stamp for that file. % % Date Stamp Format: % This package changes the standard LaTeX pagestyles to include a date % stamp in the footer: % pagestyle "plain" % - left justified date stamp with centered page number in footer % pagestyle "empty" % - left justified date stamp in footer % pagestyle "headers" % - left justified date stamp in footer % % Notes: % The \datestampbox macro defines a zero-sized box containing the datestamp. % This can be included in the footer of a custom page layout. For instance % it can be used with the fancyhdr package, % \fancyfoot[LO,RE]{\datestampbox} % % The \datestampoffset dimen variable can be used to control the vertical % position of the date stamp. For printers that do not allow printing close % to the edge of the paper, or for documents in which the footer comes very % close to the bottom of the physical page, this value may have to be % changed. The default value is 5ex. % % $Id: datestamp.sty,v 1.12 1997/08/26 13:01:47 kabal Exp $ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{datestamp}[1996/12/27] % date stamp format \newdimen\datestampoffset \datestampoffset = 5ex \def\datestampfont{\reset@font\bfseries\scriptsize} % date stamp box \newcount\datestampcount \global\datestampcount=0 \newcount\datestamplimit \def\datestampbox{% \global\advance \datestampcount by 1 \ifnum \datestampcount > \datestamplimit \else \leavevmode\lower \datestampoffset \hbox to 0pt{\datestampfont \@datestamp \hskip 0pt minus 1fil\relax}% \fi} % Set up the options \DeclareOption{off}{\datestamplimit=0} \DeclareOption{first}{\datestamplimit=1} \DeclareOption{all}{\datestamplimit=999999} \ExecuteOptions{all} \ProcessOptions % Set up the page styles include the date in the footer \let\SVps@empty=\ps@empty \def\ps@empty{\SVps@empty \def\@oddfoot{\datestampbox\hfil}% \let\@evenfoot\@oddfoot} \let\SVps@plain=\ps@plain \def\ps@plain{\SVps@plain \def\@oddfoot{\datestampbox\reset@font\hfil\thepage\hfil}% \let\@evenfoot\@oddfoot} \let\SVps@headings=\ps@headings \def\ps@headings{\SVps@headings \def\@oddfoot{\datestampbox\hfil}% \let\@evenfoot\@oddfoot} % Set the date in the footer immediately \let\df@even=\@evenfoot \let\df@odd=\@oddfoot \def\@evenfoot{\datestampbox\df@even}% \def\@oddfoot{\datestampbox\df@odd}% % Redefine \include to reset the datestamp (\include cannot be nested) % Notes: the \include macro essentially expands to % \clearpage \input xxx.tex \clearpage % Here we force a \clearpage or \cleardoublepage (depending on the setting % of the openright/openany options and reset the datestamp counters before % invoking the code for the original \include macro. The \clearpage inside % the original \include macro is then a no-op, as is any \clearpage or % \cleardoublepage inside a \chapter macro. \let\SVinclude=\include \def\cdp{\if@openright \cleardoublepage \else \clearpage \fi} \def\include #1{\ifx\if@openright\@undefined \clearpage \else \cdp % Hide the \if@openright for proper nesting \fi \edef\SV@ds{\@datestamp} \setdatestampvalue\relax \edef\SVdscount{\the\datestampcount} \global\datestampcount=0 \SVinclude {#1}% \setdatestampvalue[\SV@ds]% \global\datestampcount=\SVdscount} % Set the date stamp value \newcommand \setdatestampvalue [1][\the\year/\two@digits{\the\month}/\two@digits{\the\day}]{% \def\@datestamp{#1}} \setdatestampvalue \relax \let \datestamp = \setdatestampvalue % Macro to define \@date using the date from the rcs keyword string \def\rcs #1{\df@idparse |#1 $ = = - - $ $ |} \def\df@idparse |#1 #2 #3 #4 #5 #6 #7 #8 #9|{% \ifx #4=% \else \ifx #8$% \typeout{File: \df@fname |#2,v|, revision #3 #4}% \setdatestampvalue [#4]% \else \typeout{File: \df@fname |#2,v|, revision #3 #4 locked}% \setdatestampvalue \relax \fi \fi} \def\df@fname|#1,v#2|{#1}