From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/mversion/README | 7 ++ macros/latex/contrib/mversion/mVersion.dtx | 191 +++++++++++++++++++++++++++++ macros/latex/contrib/mversion/mVersion.ins | 55 +++++++++ macros/latex/contrib/mversion/mVersion.pdf | Bin 0 -> 163317 bytes 4 files changed, 253 insertions(+) create mode 100644 macros/latex/contrib/mversion/README create mode 100644 macros/latex/contrib/mversion/mVersion.dtx create mode 100644 macros/latex/contrib/mversion/mVersion.ins create mode 100644 macros/latex/contrib/mversion/mVersion.pdf (limited to 'macros/latex/contrib/mversion') diff --git a/macros/latex/contrib/mversion/README b/macros/latex/contrib/mversion/README new file mode 100644 index 0000000000..ad397675a2 --- /dev/null +++ b/macros/latex/contrib/mversion/README @@ -0,0 +1,7 @@ +This material is subject to the LaTeX Project Public License. See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html for the details of that license. + +mVersion, v1.0.1 (c) 2011 by Michael Schmeing + +The 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. \ No newline at end of file diff --git a/macros/latex/contrib/mversion/mVersion.dtx b/macros/latex/contrib/mversion/mVersion.dtx new file mode 100644 index 0000000000..1870defbfe --- /dev/null +++ b/macros/latex/contrib/mversion/mVersion.dtx @@ -0,0 +1,191 @@ +% \iffalse meta-comment +% +% Copyright (C) 2011 by Michael Schmeing +% ------------------------------------------------------- +% +% 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} +% +%\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%\ProvidesPackage{mVersion} +%<*package> + [2013/03/11 v1.0.1 easy versioning for LaTeX] +% +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{mVersion}[2011/10/18] +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{mVersion.dtx} + \PrintChanges + \PrintIndex +\end{document} +% +% \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} +% \changes{v1.0.1}{2013/03/11}{Typos fixed} +% +% \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 |buildnumber|. 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| now 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/macros/latex/contrib/mversion/mVersion.ins b/macros/latex/contrib/mversion/mVersion.ins new file mode 100644 index 0000000000..6c0b502cd4 --- /dev/null +++ b/macros/latex/contrib/mversion/mVersion.ins @@ -0,0 +1,55 @@ +%% +%% Copyright (C) 2011 by Michael Schmeing +%% +%% 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 + +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 diff --git a/macros/latex/contrib/mversion/mVersion.pdf b/macros/latex/contrib/mversion/mVersion.pdf new file mode 100644 index 0000000000..7dfb2799a3 Binary files /dev/null and b/macros/latex/contrib/mversion/mVersion.pdf differ -- cgit v1.2.3