From a0f0ba87dbcf2517da2ce8cf713c075d8e98d281 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 17 Sep 2009 00:24:43 +0000 Subject: version.sty rewrite (16sep09) git-svn-id: svn://tug.org/texlive/trunk@15327 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/ltxmisc/version.sty | 56 ---------- Master/texmf-dist/tex/latex/version/version.sty | 141 ++++++++++++++++++++++++ 2 files changed, 141 insertions(+), 56 deletions(-) delete mode 100644 Master/texmf-dist/tex/latex/ltxmisc/version.sty create mode 100644 Master/texmf-dist/tex/latex/version/version.sty (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/tex/latex/ltxmisc/version.sty b/Master/texmf-dist/tex/latex/ltxmisc/version.sty deleted file mode 100644 index 9e8a305a84f..00000000000 --- a/Master/texmf-dist/tex/latex/ltxmisc/version.sty +++ /dev/null @@ -1,56 +0,0 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Version control macros. These let you define environments whose contents -% will be optionally added to or deleted from the text when you run LaTeX. -% Usage: place either of the following near the start of your file: -% \includeversion{NAME} -% \excludeversion{NAME} -% Here, "NAME" is any name you choose. The first one indicates that text -% between \begin{NAME} and \end{NAME} will be processed in the normal way. -% The second indicates that text between \begin{NAME} and \end{NAME} will -% be totally deleted. -% You can define environments for as many versions as you want. -% A ``comment'' environment has already been pre-defined for you with -% \excludeversion{comment}; you can override this using \includeversion. -% -% Example: -% \includeversion{abridged}\excludeversion{unabridged} -% 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} -% -% Stephen Bellantoni 1990, loosely based on "annotation.sty" by Tom Hofmann. -% -% Additional Notes: This package still works in LaTeX2e. Large -% tracts of excluded text will likely cause a "TeX capacity exceeded" -% error though. See also comment.sty, verbatim.sty, optional.sty. -% -- Donald Arseneau April, 2000 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\begingroup -\catcode`@=11\relax% -\catcode`{=12\relax\catcode`}=12\relax% -\catcode`(=1\relax \catcode`)=2\relax% -\gdef\includeversion#1(% - \expandafter\gdef\csname #1\endcsname% - ()% - \expandafter\gdef\csname end#1\endcsname% - ()% -)% -\gdef\excludeversion#1(% - \expandafter\gdef\csname #1\endcsname% - (\@bsphack\catcode`{=12\relax\catcode`}=12\relax\csname #1@NOTE\endcsname)% - \long\expandafter\gdef\csname #1@NOTE\endcsname ##1\end{#1}% - (\csname #1END@NOTE\endcsname)% - \expandafter\gdef\csname #1END@NOTE\endcsname% - (\@esphack\end(#1))% -)% -\endgroup -\excludeversion{comment} - diff --git a/Master/texmf-dist/tex/latex/version/version.sty b/Master/texmf-dist/tex/latex/version/version.sty new file mode 100644 index 00000000000..2f5868e8a7b --- /dev/null +++ b/Master/texmf-dist/tex/latex/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. -- cgit v1.2.3