summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-10-19 22:27:29 +0000
committerKarl Berry <karl@freefriends.org>2011-10-19 22:27:29 +0000
commit35f1ce3dcdb68333a18ffee104162b49936c4c26 (patch)
treea592e02cd765c5bc70b5fdcb82b532201fc94922 /Master/texmf-dist/source/latex
parentd9e308aa324878bdc4b9099f2ddef6f45399eae9 (diff)
new latex package mversion (19oct11)
git-svn-id: svn://tug.org/texlive/trunk@24330 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r--Master/texmf-dist/source/latex/mversion/mVersion.dtx190
-rw-r--r--Master/texmf-dist/source/latex/mversion/mVersion.ins55
2 files changed, 245 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/mversion/mVersion.dtx b/Master/texmf-dist/source/latex/mversion/mVersion.dtx
new file mode 100644
index 00000000000..6722b5935cc
--- /dev/null
+++ b/Master/texmf-dist/source/latex/mversion/mVersion.dtx
@@ -0,0 +1,190 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2011 by Michael Schmeing <michael.schmeing@googlemail.com>
+% -------------------------------------------------------
+%
+% This file may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.2
+% of this license or (at your option) any later version.
+% The latest version of this license is in:
+%
+% http://www.latex-project.org/lppl.txt
+%
+% and version 1.2 or later is part of all distributions of LaTeX
+% version 1999/12/01 or later.
+%
+% \fi
+%
+% \iffalse
+%<*driver>
+\ProvidesFile{mVersion.dtx}
+%</driver>
+%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+%<package>\ProvidesPackage{mVersion}
+%<*package>
+ [2011/10/18 v1.0 easy versioning for LaTeX]
+%</package>
+%
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{mVersion}[2011/10/18]
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+ \DocInput{mVersion.dtx}
+ \PrintChanges
+ \PrintIndex
+\end{document}
+%</driver>
+% \fi
+%
+% \CheckSum{0}
+%
+% \CharacterTable
+% {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
+% 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
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+%
+% \changes{v1.0}{2011/10/18}{Initial version}
+%
+% \GetFileInfo{mVersion.dtx}
+%
+%
+% \title{The \textsf{mVersion} package\thanks{This document
+% corresponds to \textsf{mVersion}~\fileversion, dated \filedate.}}
+% \author{Michael Schmeing \\ \texttt{michael.schmeing@googlemail.com}}
+%
+% \maketitle
+%
+% \section{Introduction}
+%
+% The \textsf{mVersion} package is an easy way to keep track of different versions of your document. It provides a counter that can be incremented each time you compile the document. By displaying the counter on each page, (e.g. with the \textsf{hyperref}-package) you can see which of two versions is the newer one.
+%
+% The version number is considered to consist of two parts which are separated by a dot. The first part is a fixed string that can be set by the user with |setVersion|. The second part is the build number which can be incremented by calling |increaseBuild|. The command |version| prints the complete version number, e.g. 0.1.334 with 0.1 being the fixed version number and 334 the build number.
+%
+% Fixed version number and build number are automatically stored in the file \emph{version.dat} which is created by mVersion. By calling |increaseBuild| in the preamble of your document, you can increase the build number of your document each time you compile.
+%
+% \section{Usage}
+%
+% The \textsf{mVersion} package provides three commands.
+%
+% \DescribeMacro{version}
+% This command prints out the version number consisting of the fixed part,
+% followed by a dot and the build number.
+%
+% \DescribeMacro{setBuild}
+% Sets the fixed part of the version number
+%
+% \DescribeMacro{increaseBuild}
+% Each time |increaseBuild| is called, the build number that can be
+% displayed with |version| is increased by one.
+%
+% \StopEventually{}
+% \PrintIndex
+% \section{Implementation}
+%
+% We begin with a small macro |parseline| that reads a line of the form X;Y followed by one space. It then assigns X to |versionnumber| and Y to |bulidnumber|. This macro helps reading the fixed version number and the build number from the file \emph{version.dat}. Since \LaTeX\ adds an additional space to each line it reads from file, we need this macro.
+% \begin{macrocode}
+\def\parseline#1;#2 %this space is important
+{
+ \def\versionnumber{#1}
+ \def\buildnumber{#2}
+}
+% \end{macrocode}
+%
+% \subsection{Things to do on startup}
+% First, check if version file \emph{version.dat} exsists.
+% \begin{macrocode}
+\IfFileExists{version.dat}
+{ }
+% \end{macrocode}
+% If not, initialize with version number 0.0 and build number 0 and write the version file to disk. Note that the version file stores the version information in the format X;Y with X being the fixed version number and Y the build number.
+% \begin{macrocode}
+{
+ \newwrite\outfile
+ \immediate\openout\outfile=version.dat
+ \immediate\write\outfile{0.0;0}
+ \immediate\closeout\outfile
+}
+% \end{macrocode}
+% After making sure that the version file exists, read version and build number from version file
+% \begin{macrocode}
+\newread\versionfile
+\openin\versionfile=version.dat
+\read\versionfile to \versionline
+\closein\versionfile
+% \end{macrocode}
+% |versionline| no contains the version information in the X;Y--format but with an additional space following. Therefore, we let |versionline| be parsed by |pareseline|.
+% \begin{macrocode}
+\expandafter\parseline\versionline
+% \end{macrocode}
+% Finally, we initialize the build counter
+% \begin{macrocode}
+\newcounter{buildcounter}
+\setcounter{buildcounter}{\buildnumber}
+% \end{macrocode}
+%
+% \subsection{Command definitions}
+%
+% \begin{macro}{\version}
+% Get the current version number.
+% \begin{macrocode}
+ \newcommand{\version}{\versionnumber.\thebuildcounter}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setVersion}
+% |setVersion| lets you set the fixed version number. First, write the new version number and old build number to version file
+% \begin{macrocode}
+\newcommand{\setVersion}[1]
+{
+ \newwrite\outfile
+ \immediate\openout\outfile=version.dat
+ \immediate\write\outfile{#1;\thebuildcounter}
+ \immediate\closeout\outfile
+% \end{macrocode}
+% Now re-read version file to re-read version number (not build number)
+% \begin{macrocode}
+ \newread\versionfile
+ \openin\versionfile=version.dat
+ \read\versionfile to \versionline
+ \expandafter\parseline\versionline
+ \closein\versionfile
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\increaseBuild}
+%Increase build number by one and save new version and build number to version file. By calling |increaseBuild| in the preamble, the build number is increased each time the document is compiled.
+% \begin{macrocode}
+\newcommand{\increaseBuild}
+{
+% \end{macrocode}
+ %Increase build number
+% \begin{macrocode}
+ \stepcounter{buildcounter}
+% \end{macrocode}
+ %Save version and build number to version file
+% \begin{macrocode}
+ \newwrite\outfile
+ \immediate\openout\outfile=version.dat
+ \immediate\write\outfile{\versionnumber;\thebuildcounter}
+ \immediate\closeout\outfile
+}
+% \end{macrocode}
+% \end{macro}
+% \Finale
+\endinput
diff --git a/Master/texmf-dist/source/latex/mversion/mVersion.ins b/Master/texmf-dist/source/latex/mversion/mVersion.ins
new file mode 100644
index 00000000000..6c0b502cd4a
--- /dev/null
+++ b/Master/texmf-dist/source/latex/mversion/mVersion.ins
@@ -0,0 +1,55 @@
+%%
+%% Copyright (C) 2011 by Michael Schmeing <michael.schmeing@googlemail.com>
+%%
+%% This file may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License, either version 1.2 of this license
+%% or (at your option) any later version. The latest version of this
+%% license is in:
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% and version 1.2 or later is part of all distributions of LaTeX version
+%% 1999/12/01 or later.
+%%
+
+\input docstrip.tex
+\keepsilent
+
+\usedir{tex/latex/mVersion}
+
+\preamble
+
+This is a generated file.
+
+Copyright (C) 2011 by Michael Schmeing <michael.schmeing@googlemail.com>
+
+This file may be distributed and/or modified under the conditions of
+the LaTeX Project Public License, either version 1.2 of this license
+or (at your option) any later version. The latest version of this
+license is in:
+
+ http://www.latex-project.org/lppl.txt
+
+and version 1.2 or later is part of all distributions of LaTeX version
+1999/12/01 or later.
+
+\endpreamble
+
+\generate{\file{mVersion.sty}{\from{mVersion.dtx}{package}}}
+
+\obeyspaces
+\Msg{*************************************************************}
+\Msg{* *}
+\Msg{* To finish the installation you have to move the following *}
+\Msg{* file into a directory searched by TeX: *}
+\Msg{* *}
+\Msg{* mVersion.sty *}
+\Msg{* *}
+\Msg{* To produce the documentation run the file skeleton.dtx *}
+\Msg{* through LaTeX. *}
+\Msg{* *}
+\Msg{* Happy TeXing! *}
+\Msg{* *}
+\Msg{*************************************************************}
+
+\endbatchfile