summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/version
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/version
Initial commit
Diffstat (limited to 'macros/latex/contrib/version')
-rw-r--r--macros/latex/contrib/version/version-doc.pdfbin0 -> 302653 bytes
-rw-r--r--macros/latex/contrib/version/version-doc.tex104
-rw-r--r--macros/latex/contrib/version/version.sty141
3 files changed, 245 insertions, 0 deletions
diff --git a/macros/latex/contrib/version/version-doc.pdf b/macros/latex/contrib/version/version-doc.pdf
new file mode 100644
index 0000000000..26d9a3abe8
--- /dev/null
+++ b/macros/latex/contrib/version/version-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/version/version-doc.tex b/macros/latex/contrib/version/version-doc.tex
new file mode 100644
index 0000000000..72b53341e2
--- /dev/null
+++ b/macros/latex/contrib/version/version-doc.tex
@@ -0,0 +1,104 @@
+\documentclass[pagesize=auto, fontsize=12pt, DIV=10]{scrartcl}
+
+\usepackage{fixltx2e}
+\usepackage{etex}
+\usepackage{xspace}
+\usepackage{lmodern}
+\usepackage[T1]{fontenc}
+\usepackage{textcomp}
+\usepackage[svgnames]{xcolor}
+\usepackage{listings}
+\usepackage{microtype}
+\usepackage{hyperref}
+
+\newcommand*{\mail}[1]{\href{mailto:#1}{\texttt{#1}}}
+\newcommand*{\pkg}[1]{\textsf{#1}}
+\newcommand*{\cs}[1]{\texttt{\textbackslash#1}}
+\makeatletter
+\newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}}
+\makeatother
+\newcommand*{\env}[1]{\texttt{#1}}
+\newcommand*{\meta}[1]{\textlangle\textsl{#1}\textrangle}
+\newcommand*{\marg}[1]{\texttt{\{}\meta{#1}\texttt{\}}}
+\newcommand*{\oarg}[1]{\texttt{[}\meta{#1}\texttt{]}}
+
+\addtokomafont{title}{\rmfamily}
+
+\lstset{%
+ language=[LaTeX]TeX,%
+ columns=flexible,%
+ upquote=true,%
+ numbers=left,%
+ basicstyle=\ttfamily,%
+ keywordstyle=\color{Navy},%
+ commentstyle=\color{DimGray},%
+ stringstyle=\color{SeaGreen},%
+ numberstyle=\scriptsize\color{SlateGray}%
+}
+
+\title{The \pkg{version} package\thanks{This manual corresponds to \pkg{version.sty}~v2.0, dated~2009/09/15.}}
+\author{Donald Arseneau\thanks{\mail{asnd@triumf.ca}}\and Stephen Bellantoni}
+\date{2009/09/15}
+
+
+\begin{document}
+
+\maketitle
+
+\noindent
+Version control macros. This package lets you define environments whose
+contents will be optionally included in or excluded from the text when
+you run \LaTeX.
+
+Maybe you should be using one of \pkg{versions.sty}, \pkg{comment.sty}, or \pkg{optional.sty}.
+
+
+\section{Usage:}
+
+\begin{description}
+\item[\cmd{\includeversion}\marg{name}] \leavevmode \\
+ After this declaration, contents of the environment \meta{name}, that is,
+ text between \cmd{\begin}\marg{name} and \cmd{\end}\marg{name}, will be processed in the
+ normal way. If an environment called \meta{name} is already defined, that
+ definition is retained; if no such environment exists a simple
+ definition is provided.
+
+\item[\cmd{\excludeversion}\marg{name}] \leavevmode \\
+ This indicates that text between \cmd{\begin}\marg{name} and \cmd{\end}\marg{name} will
+ be totally deleted. Very long sections of excluded text might cause
+ a `\TeX\ capacity exceeded' error. Exclusion ends with the first
+ detected \cmd{\end}\marg{name}, even if there are additional \cmd{\begin}\marg{name}
+ declarations in the skipped text; that is, nesting of environments
+ is not permitted. Skipped text may have unbalanced braces, if
+ they would also work in the \cmd{\includeversion} case.
+
+\item[\cmd{\excludeversion}\oarg{text}\marg{name}] \leavevmode \\
+ This indicates that text between \cmd{\begin}\marg{name} and \cmd{\end}\marg{name} will
+ be replaced by the specified \meta{text}.
+\end{description}
+
+You can define environments for as many versions as you want.
+A `\env{comment}' environment has already been pre-defined with
+\verb+\excludeversion{comment}+; you can override this by declaring
+\verb+\includeversion{comment}+.
+
+
+\section{Example:}
+
+\begin{lstlisting}
+\includeversion{abridged}\excludeversion{unabridged}
+\excludeversion[(redacted)]{redact}
+Text for the
+\begin{abridged}
+ short
+\end{abridged}
+\begin{unabridged}
+ long and really longwinded, opaque and boring
+\end{unabridged}
+version of the paper. Punctuation works correctly\begin{unabridged}
+because sphack is used\end{unabridged}.
+\begin{comment} This is deleted by default. \end{comment}
+\begin{redact}This information was withdrawn\end{redact}
+\end{lstlisting}
+
+\end{document}
diff --git a/macros/latex/contrib/version/version.sty b/macros/latex/contrib/version/version.sty
new file mode 100644
index 0000000000..2f5868e8a7
--- /dev/null
+++ b/macros/latex/contrib/version/version.sty
@@ -0,0 +1,141 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% version.sty version 2.0
+%
+% Copyright 2009 by Donald Arseneau (asnd@triumf.ca)
+% based on version.sty Copyright 1990 by Stephen Bellantoni,
+% loosely based on "annotation.sty" by Tom Hofmann.
+%
+% These macros may be freely used, transmitted, reproduced, or modified
+% provided that the copyright notice and this permission is retained.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Version control macros. This package lets you define environments whose
+% contents will be optionally included in or excluded from the text when
+% you run LaTeX.
+%
+% Maybe you should be using one of versions.sty, comment.sty, or optional.sty.
+%
+% Usage:
+%
+% \includeversion{NAME}
+% After this declaration, contents of the environment "NAME", that is,
+% text between \begin{NAME} and \end{NAME}, will be processed in the
+% normal way. If an environment called NAME is already defined, that
+% definition is retained; if no such environment exists a simple
+% definition is provided.
+%
+% \excludeversion{NAME}
+% This indicates that text between \begin{NAME} and \end{NAME} will
+% be totally deleted. Very long sections of excluded text might cause
+% a `TeX capacity exceeded' error. Exclusion ends with the first
+% detected \end{NAME}, even if there are additional \begin{NAME}
+% declarations in the skipped text; that is, nesting of environments
+% is not permitted. Skipped text may have unbalanced braces, if
+% they would also work in the \includeversion case.
+%
+% \excludeversion[text]{NAME}
+% This indicates that text between \begin{NAME} and \end{NAME} will
+% be replaced by the specified text.
+%
+% You can define environments for as many versions as you want.
+% A `comment' environment has already been pre-defined with
+% \excludeversion{comment}; you can override this by declaring
+% \includeversion{comment}.
+%
+% Example:
+% \includeversion{abridged}\excludeversion{unabridged}
+% \excludeversion[(redacted)]{redact}
+% Text for the
+% \begin{abridged}
+% short
+% \end{abridged}
+% \begin{unabridged}
+% long and really longwinded, opaque and boring
+% \end{unabridged}
+% version of the paper. Punctuation works correctly\begin{unabridged}
+% because sphack is used\end{unabridged}.
+% \begin{comment} This is deleted by default. \end{comment}
+% \begin{redact}This information was withdrawn\end{redact}
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\ProvidesPackage{version}[2009/09/15 \space v 2.0]
+
+\newcommand\includeversion[1]{%
+ \def\@tempa{\@ifundefined{@Esphack}{\@esphack}{\@Esphack}}%
+ \expandafter\ifx\csname #1\endcsname\@tempa % previously excluded ...
+ \expandafter\let\csname #1\endcsname\@undefined
+ \fi % ... so do not retain existing definition
+ \@ifundefined{#1}{% Undefined, define a stub
+ \expandafter\gdef\csname #1\endcsname{}%
+ \expandafter\gdef\csname end#1\endcsname{}%
+ \PackageInfo{version}{Including #1 environments declared}
+ }{% % defined, so retain meaning
+ \PackageInfo{version}{Retain meaning of #1 environment declared}%
+ }%
+}%
+%
+\newcommand\excludeversion[2][]{%
+ \expandafter\gdef\csname #2\endcsname{%
+ #1% optional replacement text
+ \@bsphack % avoid double spaces
+ \catcode`\&=12\catcode`\{=12\catcode`\}=12\relax
+ \@Vii@ExcludeToEnd % Do exclusion until \end{\@currenvir}
+ }%
+ \expandafter\gdef\csname end#2\endcsname{%
+ \@ifundefined{@Esphack}{\@esphack}{\@Esphack}}%
+ \PackageInfo{version}{Excluding #2 environments declared}%
+}%
+%
+% Consume text delimited by the token \end followed by
+% the current environment name. Nesting is **NOT** followed
+%
+\long\def\@Vii@ExcludeToEnd#1\end#2{%
+ \def\@tempa{#2}%
+ \ifx\@tempa\@Vii@Brace
+ \let\@tempa\@Vii@ReadEnd
+ \else
+ \ifx\@tempa\@currenvir
+ \def\@tempa{\end{#2}}%
+ \else
+ \def\@tempa{\@Vii@ExcludeToEnd}%
+ \fi
+ \fi
+ \@tempa
+}
+%
+\edef\@Vii@Brace{\string{}%
+%
+\expandafter\def\expandafter\@Vii@ReadEnd\expandafter#\expandafter1\string}{%
+ \@Vii@ExcludeToEnd \end{#1}%
+}
+%
+\excludeversion{comment}
+
+\endinput
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% version v. 2 based on version.sty by:
+% Stephen Bellantoni 1990, loosely based on "annotation.sty" by Tom Hofmann.
+%
+% Donald Arseneau produced this version because Stephen Bellantoni had no
+% permissions explicitly stated in his version. DA has tried to remain
+% compatible but has indulged in "upgrades" (bloat) which might not be
+% proper.
+%
+% Although the code is entirely rewritten, there are a few principal
+% differences with version 2:
+%
+% Verbatim catcoding of braces (to scan over unbalanced braces) is
+% still applied, but is not required to be effective: the \end{NAME}
+% will be detected whether the catcode changes are effective or not.
+%
+% Verbatim catcode for & is set to allow skipping rows of a tabular.
+%
+% Definitions of existing environments are now retained by \includeversion,
+% unless the existing definition is the one made by \excludeversion.
+%
+% Added optional argument for \excludeversion for a textual tag to
+% replace the excluded content.