From a45a2d11fd0a3fbd39632658656b7e1164aea376 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 23 Sep 2007 22:57:10 +0000 Subject: new latex package environ (23sep07) git-svn-id: svn://tug.org/texlive/trunk@5020 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/environ/environ.cfg | 30 ++++++ Master/texmf-dist/tex/latex/environ/environ.sty | 117 ++++++++++++++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/environ/environ.cfg create mode 100644 Master/texmf-dist/tex/latex/environ/environ.sty (limited to 'Master/texmf-dist/tex/latex/environ') diff --git a/Master/texmf-dist/tex/latex/environ/environ.cfg b/Master/texmf-dist/tex/latex/environ/environ.cfg new file mode 100644 index 00000000000..51638f6a061 --- /dev/null +++ b/Master/texmf-dist/tex/latex/environ/environ.cfg @@ -0,0 +1,30 @@ +%% +%% This is file `environ.cfg', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% environ.dtx (with options: `defaults') +%% +%% __________________________________ +%% Copyright (C) 2007 Will Robertson +%% +%% License information appended. +%% +%% +%% Copyright (C) 2007 by Will Robertson +%% +%% Distributable under the LaTeX Project Public License, +%% version 1.3c or higher (your choice). The latest version of +%% this license is at: http://www.latex-project.org/lppl.txt +%% +%% This work is "maintained" (as per LPPL maintenance status) +%% by Will Robertson. +%% +%% This work consists of the file environ.dtx +%% and the derived files environ.pdf, +%% environ.sty, and +%% environ.ins. +%% +%% +%% End of file `environ.cfg'. diff --git a/Master/texmf-dist/tex/latex/environ/environ.sty b/Master/texmf-dist/tex/latex/environ/environ.sty new file mode 100644 index 00000000000..99469eb1f6b --- /dev/null +++ b/Master/texmf-dist/tex/latex/environ/environ.sty @@ -0,0 +1,117 @@ +%% +%% This is file `environ.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% environ.dtx (with options: `package') +%% +%% __________________________________ +%% Copyright (C) 2007 Will Robertson +%% +%% License information appended. +%% +\ProvidesPackage{environ}[2007/09/23 v0.1 A new environment syntax] +\unless\ifdefined\collect@body + \newtoks\@emptytoks + \newtoks\@envbody + \def\collect@body#1{% + \@envbody{\expandafter#1\expandafter{\the\@envbody}}% + \edef\process@envbody{\the\@envbody\noexpand\end{\@currenvir}}% + \@envbody\@emptytoks \def\begin@stack{b}% + \begingroup + \expandafter\let\csname\@currenvir\endcsname\collect@@body + \edef\process@envbody{\expandafter\noexpand\csname\@currenvir\endcsname}% + \process@envbody + } + \def\push@begins#1\begin#2{% + \ifx\end#2\else + b\expandafter\push@begins + \fi} + \def\addto@envbody#1{% + \global\@envbody\expandafter{\the\@envbody#1}} + \def\collect@@body#1\end#2{% + \edef\begin@stack{% + \push@begins#1\begin\end \expandafter\@gobble\begin@stack}% + \ifx\@empty\begin@stack + \endgroup + \@checkend{#2}% + \addto@envbody{#1}% + \else + \addto@envbody{#1\end{#2}}% + \fi + \process@envbody} +\fi +\long\def\Collect@Body#1{% + \@envbody{\expandafter#1\expandafter{\the\@envbody}}% + \edef\process@envbody{\the\@envbody\noexpand\end{\@currenvir}}% + \@envbody\@emptytoks \def\begin@stack{b}% + \begingroup + \expandafter\let\csname\@currenvir\endcsname\Collect@@Body + \edef\process@envbody{\expandafter\noexpand\csname\@currenvir\endcsname}% + \process@envbody +} +\long\def\Push@Begins#1\begin#2{% + \ifx\end#2\else + b\expandafter\Push@Begins + \fi} +\long\def\Addto@Envbody#1{% + \global\@envbody\expandafter{\the\@envbody#1}} +\long\def\Collect@@Body#1\end#2{% + \edef\begin@stack{% + \Push@Begins#1\begin\end\expandafter\@gobble\begin@stack}% + \ifx\@empty\begin@stack + \endgroup + \@checkend{#2}% + \Addto@Envbody{#1}% + \else + \Addto@Envbody{#1\end{#2}}% + \fi + \process@envbody} +\newcommand\NewEnvironment{% + \let\env@newenvironment\newenvironment + \let\env@newcommand\newcommand + \Make@Environment} +\newcommand\RenewEnvironment{% + \let\env@newenvironment\renewenvironment + \let\env@newcommand\renewcommand + \Make@Environment} +\newcommand\Make@Environment[2]{% + \expandafter\let\csname env@args@#1\endcsname\ignorespaces + \env@newenvironment{#1}{% + \expandafter\Collect@Body\csname env@@#1\endcsname}{\ignorespacesafterend}% + \expandafter\env@newcommand\csname env@@#1\endcsname[1]{% + \csname env@@@#1\endcsname{% + \csname env@args@\@currenvir\endcsname##1\unskip}}% + \expandafter\env@newcommand\csname env@@@#1\endcsname[1]{#2}} +\newcommand\EnvironArgs[1]{% + \@ifnextchar[ + {\Env@Args{#1}} + {\Env@Args{#1}[0]}} +\long\def\Env@Args#1[#2]{% + \@ifnextchar[ + {\Env@@@Args{#1}[#2]} + {\Env@@Args{#1}[#2]}} +\long\def\Env@@Args#1[#2]#3{% + \expandafter\renewcommand\csname env@args@#1\endcsname[#2]{% + #3\ignorespaces}} +\long\def\Env@@@Args#1[#2][#3]#4{% + \expandafter\renewcommand\csname env@args@#1\endcsname[#2][#3]{% + #4\ignorespaces}} +%% +%% Copyright (C) 2007 by Will Robertson +%% +%% Distributable under the LaTeX Project Public License, +%% version 1.3c or higher (your choice). The latest version of +%% this license is at: http://www.latex-project.org/lppl.txt +%% +%% This work is "maintained" (as per LPPL maintenance status) +%% by Will Robertson. +%% +%% This work consists of the file environ.dtx +%% and the derived files environ.pdf, +%% environ.sty, and +%% environ.ins. +%% +%% +%% End of file `environ.sty'. -- cgit v1.2.3