% % \iffalse % % The first part is a comment to the reader(s) of `vrsion.dtx'. % % vrsion.dtx version 1.5.a, June 5, 1998 % (c) 1994-1998 by Mats Dahlgren (matsd@sssk.se) % % Please see the information in file `vrsion.ins' on how you % may use and (re-)distribute this file. Run LaTeX on the file % `vrsion.ins' to get a .sty-file and on vrsion.dtx to obtain the % instructions. % % This file may NOT be distributed if not accompanied by 'vrsion.ins'. % %<*driver> \documentclass[a4paper]{ltxdoc} \textwidth=150mm \textheight=210mm \topmargin=0mm \oddsidemargin=5mm \evensidemargin=5mm \RecordChanges %\begin{document} \DocInput{vrsion.dtx} % \PrintChanges \end{document} % % \fi % % \CheckSum{804} % % \def\filename{vrsion.dtx} % \def\fileversion{1.5} % \def\filedate{1997/07/16}\def\docdate{1998/06/05} % \date{\docdate} % \changes{1.0}{1994/12/28}{First version of `version' package.} % \changes{1.1}{1995/05/15}{Fixed extra spaces and warning in % the documentation that \texttt{\textbackslash version} is a fragile % command. Also changed the name of the package.} % \changes{1.2}{1995/05/31}{Fixed \textsf{babel} % incompatibility and made \texttt{\textbackslash version} robust.} % \changes{1.3}{1996/02/08}{Cosmetics in the installation % routine, adjustments to changes in \textsf{babel}, making use % of \textsf{xspace} if loaded, and a working solution to % problems with \texttt{\textbackslash maketitle} command.} % \changes{1.4}{1996/06/25}{Fixed incompatibility with the % \textsf{koma-script} package.} % \changes{1.41}{1997/02/22}{Upgraded documentation.} % \changes{1.5}{1997/07/16}{Adjusted \textsf{babel} compatibility % to work with \textsf{babel} v.3.6h} % \MakeShortVerb{\|} % \title{\textsf{vrsion}\\ -- a \LaTeX{} Macro for version Numbering of % Files\thanks{This document describes \textsf{vrsion} version % \fileversion , and was last revised on \docdate.}} % \author{Mats Dahlgren\footnote{Email:\ \texttt{matsd@sssk.se}\ \ \ % Web:\ \texttt{http://www.homenet.se/matsd/}}} % \begin{document} % \maketitle % \begin{abstract} % The \textsf{vrsion} package provides a user-friendly way to % introduce file version numbers in \LaTeX{} documents. % It remembers the previous version number, also when % the |.aux|-file is corrupted (due to errors in the % \LaTeX{} run).\\ \small This file and the package:\ % Copyright \copyright\ 1994-98 by Mats Dahlgren. All rights % reserved. % \end{abstract} % % \section{Introduction} % \DescribeMacro\version % This package provides one command, |\version|, which % puts a version number where it appears. The version % number is increased each time \LaTeX{} is run, % \textit{i.e.}\ it numbers the |.dvi|-file. If the % package is loaded but the command |\version| is not % issued, the present version number is preserved. % Numbering can be incremented at three different levels: % units, tenths, and hundreds. A change between two of these % is obtained by changing the package option. After a change % of steplength, the previous version number is % incremented with the new steplength. The version number % can be held constant by using the command % \DescribeMacro\keepversion % |\keepversion|; this enables the version number to be % printed without being increased. (|\keepversion| can be % \DescribeMacro\stepversion % overridden by the command |\stepversion|.) % % This userguide is also available in \texttt{.pdf}-format % on the internet. It is found from my \LaTeX\ web page: % \texttt{http://www.homenet.se/matsd/latex/} % % \section{Userguide} % \subsection{Requirements} % The file |vrsion.sty| must be available in the user's % |TEXINPUTS| directories. It requires \LaTeXe{} of % 1996/12/01 (or newer). % % \subsection{Usage} % The package is included by stating \\ % | \usepackage[|\textit{option}|]{vrsion}|\\ % \DescribeMacro{one} \DescribeMacro{ten} % \DescribeMacro{hundred} \DescribeMacro{xspace} % in the document preamble. It can take one of the % options |one|, |ten|, and |hundred|, and in addition |xspace|. % To produce a % version number anywhere in your document you issue the % \DescribeMacro\version % command |\version| at the desired place in your \LaTeX{} % input file.\footnote{Notice that the text ``version'' % is \textit{not} produced by the % \texttt{\textbackslash version} command.} The % version number will then be incremented each time you % run \LaTeX{} on the file. The command |\version| is % robust.\footnote{Thanks to Timothy Robertson % (\texttt{timothyr@cmbr.phys.cmu.edu}) for bringing my % attention to the problem of \texttt{\textbackslash version} % being fragile.} Depending on the option % used, the version number will be an integer (no option % or option |one|), a number with one decimal (option % |ten|), or a two-decimal number (option |hundred|). % If the option |xspace| is specified, the \textsf{xspace} % package is loaded and its features are benefited from. (If % the \textsf{xspace} package is loaded by a separate % |\usepackage| statement or by another package, its features % are used by \textsf{vrsion}.) % % When changing from one option (of |one|, |ten|, or |hundred|) % to another, the previous % format of the version number will be changed according % to the new option. If a smaller increment is % specified, the next increment will simply append one % digit |1| to the old version number; \textit{e.g.}\ a % change from option |ten| to |hundred| after version 3.2 % will result in version 3.21. If a larger increment is % specified, the old version number will be truncated % before the increment; \textit{e.g.}\ a change from % option |hundred| to |ten| after version 3.25 % will result in version 3.3. You should (normally) not % use the command |\version| more once in a document. % The version number is stored in a file with extension % `|vrs|' in the default directory. (The full name of this % file is |\jobname.vrs|.) % % If you want your document to contain a version % number without having it incremented each time % you run \LaTeX{}, you should issue the command % \DescribeMacro\keepversion % |\keepversion| in the document (preamble). This % switches off the incrementation mechanism and prevents % the package from writing an updated |.vrs|-file. % The |\keepversion| command can be cancelled at % any later place in the document by issuing the % \DescribeMacro\stepversion % command |\stepversion|. The action taken by the % |\version| command is determined by which of these % two was last issued. % % Typically, you would load the \textsf{vrsion} package % with the desired option and use the command % |\version| where you want your document to state % its version number. Normally, you would have the % |\keepversion| command in the preamble, but % comment it out on the first \LaTeX{} run when you % prepare to print a new version and then have the % |\keepversion| in action during the \LaTeX{} runs % needed to resolve the references. % % When it is desired to repeat the version number % several times in a document, issue a % |\keepversion| directly after the first use of % |\version|. This will then produce the same % version number at all occurrences; and the version % number will be incremented according to the use of % |\keepversion| in the preamble. % % If the increase of the version number is to occur % at any stage later than the fist occurrence of % |\version|, the occurrence of |\version| % which is to increase the version number should be % preceeded by a |\stepversion| command (and % followed by |\keepversion| to prevent further % increments). The author can not think of any % reason why this should be desired, but it can be % achieved anyway$\ldots$ % % \subsection{Known Problems} % \begin{itemize} % \item At the present (\filedate), \textsf{vrsion} does not % work properly with neither the \textsf{letter} nor the % \textsf{scrlettr} document classes. % \item The |\vrsion| package is not working properly with the % |\include{|\textit{file}|}| command; use |\input{|\textit{file}|}| % instead. % \item If the command |\version| is issued more than once % in a document, the version number will be incremented % at each occurrence and produce different version % numbers at the different occurrences (unless % |\keepversion| is in effect). This may typically be a % problem if you use |\version| in the page header or footer. % This is avoided if |\keepversion| is issued somewhere on the % second page. % \end{itemize} % % \section{History} % The first version of the package was released in late % December of 1994. The package % was created with useful help and ideas from Johan % Fr\"oberg (\texttt{emgion@physchem.kth.se}). \par % The \textsf{vrsion} package version \fileversion{} has % been tested with \LaTeXe{} of 1997/06/01 % using MiK\TeX\ 1.07 running % \TeX{} 3.14159 under Win95. Please send bug reports % (see below), corrections, additions, suggestions, % \textit{etc.}\ to me at \texttt{matsd@sssk.se}. % % \subsection{Changes from previous versions} % % In \textsf{vrsion} (|version|) version 1.0 the macro % |\@skrivner| caused extra % space to be inserted in front of the version number. With % \textsf{vrsion} version 1.1 and later this is avoided. % % In version 1.1 the \textsf{vrsion} package had incompatibility % problems with the \textsf{babel} package.\footnote{Thanks to Peter % Ryder (\texttt{ryder@theo.physik.uni-bremen.de}) for % bringing my attention to this problem.} With \textsf{vrsion} % version 1.2 this problem is eliminated. Also, the command % |\version| has been made robust. % % In version 1.3, some adjustments to changes in the \textsf{babel} % package have been made,\footnote{Thanks to Cornelius C.\ Noack % (\texttt{noack@physik.uni-bremen.de}) for bringing my attention to % the re-appearance of the \textsf{babel} incompatibility.} % if the \textsf{xspace} package is % loaded, its features are made use of. Also, some problems with % |\maketitle| issuing extra blank page(s) have been % eliminated,\footnote{Thanks to Ludek Matyska (\texttt{ludek@muni.cz}) % for pointing out this problem.} it % seems (at least for the \textsf{article}, \textsf{report}, and % \textsf{book} classes). Furthermore, some cosmetics % in the installation routine have been added. % % Version 1.4 eliminated an incompatibility with % the \textsf{koma-script} package. The incompatibility was that % some features of \textsf{koma-script}'s version of the % |\maketitle| command were lost when \textsf{vrsion} was % loaded.\footnote{Thanks to Christofer P.\ Baron % (\texttt{baron@iml.fgh.de}) for bringing my attention to this % problem.} Furthermore, some |\typeout| statements have been % removed and the processing order of some of the macro % definitions has been changed. % % With \textsf{babel} version 3.6 the incompatibility between % the \textsf{vrsion} and \textsf{babel} packages was apperaring % again.\footnote{Due to an internal change of the \textsf{babel} % code} In \textsf{vrsion} version 1.5 this is adjusted. % % \section{Sending a Bug Report} % \textsf{vrsion} is most likely to contain bugs. % Reports of bugs in the package are most welcome. % When filing a bug report, % please take the following actions: % \begin{enumerate} % \item Ensure your problem is not due to your inputfile; % \item Ensure your problem is not due to % your own package(s) or class(es); % \item Ensure your problem is not covered in the section % ''Known Problems'' above; % \item Try to locate the problem by writing a minimal % \LaTeX{} input file which reproduces the problem. % Include the command\\ % | \setcounter{errorcontextlines}{999}|\\ % in your input; % \item Run your file through \LaTeX ; % \item Send a description of your problem, the input file % and the log file via e-mail to:\\ \hspace*{5mm} % \texttt{matsd@sssk.se}. % \end{enumerate} % % % {\itshape Enjoy your \LaTeX!\raisebox{-\baselineskip}{mats d.}} % \StopEventually{\par\vfill\hfill{\scriptsize Copyright % \copyright{} 1996-98 by Mats Dahlgren.}} % % % \section{The Code} % For the interested reader(s), here is a short description % of the code. % % First, the package should identify itself: % \iffalse %<*paketkod> % \fi % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1996/12/01] \ProvidesPackage{vrsion}% [1997/07/16 version numbering of LaTeX files (v.1.5).] % \end{macrocode} % \par Some counters and booleans used % are to be defined first. Also the user commands % |\keepversion| and |\stepversion|, which only (re-)set % the |Keepversion| boolean, are defined. % \begin{macrocode} \newcounter{versionnr} \newcounter{versionnrten}[versionnr] \newcounter{versionnrhundred}[versionnrten] \@addtoreset{versionnrhundred}{versionnr} \newif\ifKeepversion \Keepversionfalse \newif\ifxspc \xspcfalse \newcommand{\keepversion}{\global\Keepversiontrue} \newcommand{\stepversion}{\global\Keepversionfalse} % \end{macrocode} % \par Next, the options are declared. The declaration of % option |one| is the default version of the |\version| % macro. If the boolean % |Keepversion| (set by the command |\keepversion|) is % true, no increase of the version number is preformed, % nor is anything written to the |.vrs|-file. The command % |\@skrivner| is responsible for writing the |.vrs|-file % (``skriv ner'' is Swedish for ``write down''). % \begin{macrocode} \DeclareOption{one}{% \DeclareRobustCommand{\version}{% \ifKeepversion \else \stepcounter{versionnr}% \@skrivner \fi \theversionnr% \@ifundefined{xspace}{}{\xspace}% } } % \end{macrocode} % The |ten| option modifies the |\version| command to % produce a decimal number and steps the integer version % number if the decimal part reaches 10. % \begin{macrocode} \DeclareOption{ten}{% \DeclareRobustCommand{\version}{% \ifKeepversion \else \stepcounter{versionnrten}% \ifnum\theversionnrten=10\stepcounter{versionnr} \fi \@skrivner \fi \theversionnr .\theversionnrten% \@ifundefined{xspace}{}{\xspace}% } } % \end{macrocode} % The option |hundred| does the same as |ten|, but with % a two-decimal number. % \begin{macrocode} \DeclareOption{hundred}{% \DeclareRobustCommand{\version}{% \ifKeepversion \else \stepcounter{versionnrhundred}% \ifnum\theversionnrhundred=10\stepcounter{versionnrten} \fi \ifnum\theversionnrten=10\stepcounter{versionnr} \fi \@skrivner \fi \theversionnr .\theversionnrten\theversionnrhundred% \@ifundefined{xspace}{}{\xspace}% } } % \end{macrocode} % The |xspace| option, which only forces the \textsf{xspace} package % to be loaded, is quite short in the code: % \begin{macrocode} \DeclareOption{xspace}{\global\xspctrue} % \end{macrocode} % All other options which may be specified are to be % ignored: % \begin{macrocode} \DeclareOption*{\OptionNotUsed} % \end{macrocode} % \par Now we can process the options, and -- if requested -- load % the \textsf{xspace} package. % \begin{macrocode} \ExecuteOptions{one} \ProcessOptions \ifxspc\RequirePackage{xspace}\fi % \end{macrocode} % \par Now the task is to define the internals. The macro % |\vrsFile| simply holds the name of the |.vrs|-file to % use. The macro |\@skrivner| writes the version number % counters to a file % in a format which is easy to deal with in % \LaTeX{}, a name-wise change\footnote{This was nessecary % to make \texttt{vrsion} compatible with \textsf{babel}.} % of the the ordinary |\label| format. The internal % macro |\@vrs| is used to avoid problems with label % change warnings and to avoid trouble with missing % version number information in the |.aux|-file when % |\keepversion| is used. As an aid, the dummy-counter % |VrsNr| is used. % \begin{macrocode} \def\vrsFile{\jobname.vrs} \newwrite\@vrs \newcounter{VrsNr} \def\@skrivner{% \setcounter{VrsNr}{\@partaux}% \addtocounter{VrsNr}{1}% \let\@vrs=\theVrsNr% \immediate\openout\@vrs\vrsFile% \immediate\write\@vrs{\relax}% \immediate\write\@vrs{% \string\vrslabel{versionsnummer}{{\theversionnr}{\thepage}}}% \immediate\write\@vrs{% \string\vrslabel{versionsnummertio}{{\theversionnrten}{\thepage}}}% \immediate\write\@vrs{% \string\vrslabel{versionsnummerhundra}{{\theversionnrhundred}{\thepage}} }% \immediate\closeout\@vrs{}% } % \end{macrocode} % \par\textsf{babel} compatibility % is obtained by defining special |\label| and |\ref| commands. % \begin{macrocode} \@ifundefined{org@ref}{\let\vrsref=\ref}{\let\vrsref=\org@ref} \@ifundefined{org@newlabel}{\let\vrslabel=\newlabel}% {\let\vrslabel=\org@newlabel} % \end{macrocode} % \par If it exists, the file |\jobname.vrs| should % be read, and the counters set accordingly. If this file % is missing, the counters should be zero. % \begin{macrocode} \IfFileExists{\vrsFile}{\@@input\vrsFile% \setcounter{versionnr}{\vrsref{versionsnummer}}% \setcounter{versionnrten}{\vrsref{versionsnummertio}}% \setcounter{versionnrhundred}{\vrsref{versionsnummerhundra}}% }{% \typeout{No file \vrsFile.}% \setcounter{versionnr}{\z@}% \setcounter{versionnrten}{\z@}% \setcounter{versionnrhundred}{\z@}% } % \end{macrocode} % \par To prevent |\maketitle| from creating extra blank pages, % some commands from the \LaTeXe{} kernel have to be slightly % modified. To make sure we use the desired definitions, the % changes are issued in an |\AtBeginDocument| command. (The % changes are that a few |\newpage| commands have been removed and % that a |\cleardoublepage| has been removed for the \textsf{book} % class.) To cope with the incompatibility of the % \textsf{koma-script} package, different modified definitions are % used. Which is to be used is tested in an |\@ifundefined| % statement. % \begin{macrocode} \AtBeginDocument{% \@ifundefined{subject}{% \if@titlepage \renewcommand\maketitle{\begin{titlepage}% \let\footnotesize\small \let\footnoterule\relax \let \footnote \thanks \null\vfil \vskip 60\p@ \begin{center}% {\LARGE \@title \par}% \vskip 3em% {\large \lineskip .75em% \begin{tabular}[t]{c}% \@author \end{tabular}\par}% \vskip 1.5em% {\large \@date \par}% \end{center}\par \@thanks \vfil\null \end{titlepage}% \setcounter{footnote}{0}% \global\let\thanks\relax \global\let\maketitle\relax \global\let\@thanks\@empty \global\let\@author\@empty \global\let\@date\@empty \global\let\@title\@empty \global\let\title\relax \global\let\author\relax \global\let\date\relax \global\let\and\relax } \else \renewcommand\maketitle{\par \begingroup \renewcommand\thefootnote{\@fnsymbol\c@footnote}% \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}% \long\def\@makefntext##1{\parindent 1em\noindent \hb@xt@1.8em{% \hss\@textsuperscript{\normalfont\@thefnmark}}##1}% \if@twocolumn \ifnum \col@number=\@ne \@maketitle \else \twocolumn[\@maketitle]% \fi \else \global\@topnum\z@ \@maketitle \fi \thispagestyle{plain}\@thanks \endgroup \setcounter{footnote}{0}% \global\let\thanks\relax \global\let\maketitle\relax \global\let\@maketitle\relax \global\let\@thanks\@empty \global\let\@author\@empty \global\let\@date\@empty \global\let\@title\@empty \global\let\title\relax \global\let\author\relax \global\let\date\relax \global\let\and\relax } \def\@maketitle{% \null \vskip 2em% \begin{center}% \let \footnote \thanks {\LARGE \@title \par}% \vskip 1.5em% {\large \lineskip .5em% \begin{tabular}[t]{c}% \@author \end{tabular}\par}% \vskip 1em% {\large \@date}% \end{center}% \par \vskip 1.5em} \fi% \renewenvironment{titlepage}{% \if@twocolumn \@restonecoltrue\onecolumn \else \@restonecolfalse \fi \thispagestyle{empty}% \setcounter{page}\@ne }% {\if@restonecol\twocolumn \else \newpage \fi \if@twoside\else \setcounter{page}\@ne \fi } }{% % \end{macrocode} % So much for the ordinary \LaTeXe{} kernel code. Next follows % the code borrowed from the \textsf{koma-script} bundle by Markus % Kohm,\footnote{Special thanks to Markus Kohm % (\texttt{Markus\underline{\space}Kohm@ka2.maus.de}) % for letting me incorporate this % code.} also with some modifications. % \begin{macrocode} \if@titlepage \newcommand*\maketitle[1][1]{\begin{titlepage}% \setcounter{page}{#1} \let\footnotesize\small \let\footnoterule\relax \let\footnote\thanks \ifx\@extratitle\@empty \else \noindent\@extratitle\next@tpage\thispagestyle{empty} \fi \ifx\@titlehead\@empty \else \noindent\begin{minipage}[t]{\textwidth} \@titlehead \end{minipage}\par \fi \null\vfill \begin{center} \ifx\@subject\@empty \else {\Large \@subject \par} \vskip 3em \fi {\huge {\sectfont \@title \par}} \vskip 3em {\Large \lineskip 0.75em \begin{tabular}[t]{c} \@author \end{tabular}\par} \vskip 1.5em {\Large \@date \par} \vskip \z@ \@plus3fill {\Large \@publishers \par} \vskip 3em \end{center}\par \@thanks \vfill\null \if@twoside\next@tpage \noindent\begin{minipage}[t]{\textwidth} \@uppertitleback \end{minipage}\par \vfill \noindent\begin{minipage}[b]{\textwidth} \@lowertitleback \end{minipage} \fi \ifx\@dedication\@empty \else \next@tpage\null\vfill {\centering \Large \@dedication \par} \vskip \z@ \@plus3fill \if@twoside \next@tpage \fi \fi \end{titlepage} \setcounter{footnote}{0}% \global\let\thanks\relax \global\let\maketitle\relax \global\let\@thanks\@empty \global\let\@author\@empty \global\let\@date\@empty \global\let\@title\@empty \global\let\@extratitle\@empty \global\let\@titlehead\@empty \global\let\@subject\@empty \global\let\@publishers\@empty \global\let\@uppertitleback\@empty \global\let\@lowertitleback\@empty \global\let\@dedication\@empty \global\let\author\relax \global\let\title\relax \global\let\extratitle\relax \global\let\titlehead\relax \global\let\subject\relax \global\let\publishers\relax \global\let\uppertitleback\relax \global\let\lowertitleback\relax \global\let\dedication\relax \global\let\date\relax \global\let\and\relax} \else \newcommand*\maketitle[1][1]{\par \begingroup \renewcommand\thefootnote{\@fnsymbol\c@footnote}% \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}% \long\def\@makefntext##1{\parindent 1em\noindent \hb@xt@1.8em{% \hss\@textsuperscript{\normalfont\@thefnmark}}##1}% \if@twocolumn \ifnum \col@number=\@ne \@maketitle \else \twocolumn[\@maketitle]% \fi \else \global\@topnum\z@ \@maketitle \fi \thispagestyle{plain}\@thanks \endgroup \setcounter{footnote}{0}% \let\thanks\relax \let\maketitle\relax \let\@maketitle\relax \global\let\@thanks\@empty \global\let\@author\@empty \global\let\@date\@empty \global\let\@title\@empty \global\let\@extratitle\@empty \global\let\@titlehead\@empty \global\let\@subject\@empty \global\let\@publishers\@empty \global\let\@uppertitleback\@empty \global\let\@lowertitleback\@empty \global\let\@dedication\@empty \global\let\author\relax \global\let\title\relax \global\let\extratitle\relax \global\let\titlehead\relax \global\let\subject\relax \global\let\publishers\relax \global\let\uppertitleback\relax \global\let\lowertitleback\relax \global\let\dedication\relax \global\let\date\relax \global\let\and\relax} \fi \def\@maketitle{% \let\footnote\thanks \ifx\@extratitle\@empty \else \noindent\@extratitle \next@tpage \if@twoside \null\next@tpage \fi \fi \ifx\@titlehead\@empty \else \noindent\begin{minipage}[t]{\textwidth} \@titlehead \end{minipage}\par \fi \null \vskip 2em% \begin{center}% \ifx\@subject\@empty \else {\Large \@subject \par} \vskip 1.5em \fi {\huge \@title \par}% \vskip 1.5em% {\Large \lineskip .5em% \begin{tabular}[t]{c}% \@author \end{tabular}\par}% \vskip 1em% {\Large \@date \par}% \vskip \z@ \@plus 1em {\Large \@publishers \par} \ifx\@dedication\@empty \else \vskip 2em {\Large \@dedication \par} \fi \end{center}% \par \vskip 2em}% \renewenvironment{titlepage}{% \if@twocolumn \@restonecoltrue\onecolumn \else \@restonecolfalse \fi \thispagestyle{empty}% \if@compatibility \setcounter{page}{0} \fi}% {\if@restonecol\twocolumn \else \newpage \fi}% }% } % \end{macrocode} % \par This brings us to the end of \textsf{vrsion}. Hope you'll % enjoy it! % \iffalse % % \fi % % \Finale % \endinput