summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/sauerj/collect.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-13 00:05:53 +0000
committerKarl Berry <karl@freefriends.org>2006-01-13 00:05:53 +0000
commit41f6accf239ea62e4f979c592c6728a616245d9f (patch)
tree82ddb0e632b70a669169fbeff04a0a83e9604fa5 /Master/texmf-dist/tex/latex/sauerj/collect.sty
parentf5c952da6432767eac2421ed364423601fb9c844 (diff)
sauerj
git-svn-id: svn://tug.org/texlive/trunk@1291 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/sauerj/collect.sty')
-rw-r--r--Master/texmf-dist/tex/latex/sauerj/collect.sty138
1 files changed, 138 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/sauerj/collect.sty b/Master/texmf-dist/tex/latex/sauerj/collect.sty
new file mode 100644
index 00000000000..64d5adb5fc2
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/sauerj/collect.sty
@@ -0,0 +1,138 @@
+%%
+%% This is file `collect.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% collect.dtx (with options: `package')
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{collect}
+ [2004/09/12 v0.9 collect the contents of an environment]
+\newcommand{\definecollection}[1]{%
+\@ifundefined{CE@@#1@out}{%
+\expandafter\newwrite\csname CE@@#1@out\endcsname%
+\expandafter\newif\csname ifCE@@#1@open\endcsname%
+\csname CE@@#1@openfalse\endcsname%
+}{%
+\PackageError{collect}{Collection `#1' has already %
+been defined}{\@ehc}%
+}%
+}
+\newenvironment{collect*}[5]{%
+\global\toks@{}%
+\def\CE@file{#1}%
+\def\CE@preenv{#2}%
+\def\CE@postenv{#3}%
+\def\CE@prefileenv{#4}%
+\def\CE@postfileenv{#5}%
+\CE@get@env@body@start%
+}{%
+\CE@ensure@opened{\CE@file}%
+\edef\@tempa{\csname CE@@\CE@file @out\endcsname}%
+\immediate\write\@tempa{\CE@meaning\CE@prefileenv}%
+\immediate\write\@tempa{\CE@meaning\CE@preenv}%
+\immediate\write\@tempa{\the\toks@}%
+\immediate\write\@tempa{\CE@meaning\CE@postenv}%
+\immediate\write\@tempa{\CE@meaning\CE@postfileenv}%
+\immediate\openout\CE@tmp@out=\jobname.tmp%
+\immediate\write\CE@tmp@out{\CE@meaning\CE@preenv}%
+\immediate\write\CE@tmp@out{\the\toks@}%
+\immediate\write\CE@tmp@out{\CE@meaning\CE@postenv}%
+\immediate\closeout\CE@tmp@out%
+\@input{\jobname.tmp}%
+\par%
+}
+\newenvironment{collect}[3]{%
+\global\toks@{}%
+\def\CE@file{#1}%
+\def\CE@prefileenv{#2}%
+\def\CE@postfileenv{#3}%
+\CE@get@env@body@start%
+}{%
+\CE@ensure@opened{\CE@file}%
+\edef\@tempa{\csname CE@@\CE@file @out\endcsname}%
+\immediate\write\@tempa{\CE@meaning\CE@prefileenv}%
+\immediate\write\@tempa{\the\toks@}%
+\immediate\write\@tempa{\CE@meaning\CE@postfileenv}%
+}
+\newcommand{\includecollection}[1]{%
+\CE@ensure@closed{#1}%
+\@input{\jobname.#1}%
+}
+\newenvironment{collectinmacro}[3]{%
+\def\CE@destmacro{#1}%
+\def\CE@postenv{#3}%
+\toks@{#2}%
+\CE@get@env@body@start%
+}{%
+\toks@\expandafter\expandafter\expandafter{%
+\expandafter\the\expandafter\toks@\CE@postenv}%
+\expandafter\expandafter\expandafter%
+\gdef\expandafter\CE@destmacro\expandafter{\the\toks@}%
+\toks@{}%
+}
+\newwrite\CE@tmp@out
+\def\CE@get@env@body@start{%
+\let\@tempa\CE@get@env@body%
+\futurelet\@tempb\CE@get@env@body@start@%
+}
+\def\CE@get@env@body@start@{%
+\ifx\@tempb\@sptoken%
+\expandafter\CE@get@env@body@start@@%
+\else%
+\expandafter\CE@get@env@body%
+\fi%
+}
+\def\CE@get@env@body@start@@{%
+\afterassignment\CE@get@env@body%
+\let\@tempb= %
+}
+\bgroup
+\catcode`\Q=3
+\long\gdef\CE@get@env@body#1\end#2{%
+\def\@tempb{#2}%
+\ifx\@tempb\@currenvir%
+\CE@get@env@body@#1Q Q%
+\def\@tempa{\end{#2}}%
+\else
+\toks@\expandafter{\the\toks@#1\end{#2}}%
+\fi%
+\@tempa%
+}
+\long\gdef\CE@get@env@body@#1 Q{%
+\CE@get@env@body@@#1Q%
+}
+
+\long\gdef\CE@get@env@body@@#1Q#2{%
+\toks@\expandafter{\the\toks@#1}%
+}
+\egroup
+\long\def\CE@meaning#1{%
+\expandafter\strip@prefix\meaning#1%
+}
+\def\CE@ensure@opened#1{%
+\@ifundefined{ifCE@@#1@open}{%
+\PackageError{collect}{Collection `#1' has not been defined}{\@ehc}%
+}{%
+\csname ifCE@@#1@open\endcsname\else%
+\expandafter\immediate\expandafter\openout%
+\csname CE@@#1@out\endcsname=\jobname.#1%
+\expandafter\global\csname CE@@#1@opentrue\endcsname%
+\fi%
+}%
+}
+\def\CE@ensure@closed#1{%
+\@ifundefined{ifCE@@#1@open}{%
+\PackageError{collect}{Collection `#1' has not been defined}{\@ehc}%
+}{%
+\csname ifCE@@#1@open\endcsname%
+\expandafter\immediate\expandafter\closeout%
+\csname CE@@#1@out\endcsname%
+\expandafter\global\csname CE@@#1@openfalse\endcsname%
+\fi%
+}%
+}
+\endinput
+%%
+%% End of file `collect.sty'.