summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/multienv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/multienv')
-rw-r--r--Master/texmf-dist/tex/latex/multienv/multienv.sty176
1 files changed, 176 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/multienv/multienv.sty b/Master/texmf-dist/tex/latex/multienv/multienv.sty
new file mode 100644
index 00000000000..cae85639b65
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/multienv/multienv.sty
@@ -0,0 +1,176 @@
+%% Copyright (C) 2012 by Martin Scharrer <martin@scharrer-online.de>
+%% --------------------------------------------------------------------
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% 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.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Martin Scharrer.
+%%
+%% This work consists of the files multienv.dtx and multienv.ins
+%% and the derived filebase multienv.sty.
+%%
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesPackage{multienv}[%
+ 2012/05/20
+ v1.0
+ Add multiple environments using a Key=value syntax]
+\newcommand{\multienv}{%
+ \begingroup
+ \@ifstar{%
+ \let\multienv@addcode\multienv@addcode@out
+ \multienv@readkeys
+ }{%
+ \let\multienv@addcode\multienv@addcode@in
+ \multienv@readkeys
+ }%
+}
+\def\endmultienv{\end@multienv\endgroup}
+\newenvironment{multienv*}{%
+ \begingroup
+ \let\multienv@addcode\multienv@addcode@out
+ \multienv@readkeys
+}{%
+ \end@multienv\endgroup
+}
+\newcommand\newmultienvironment{%
+ \let\@multi@environment\newenvironment
+ \@multienvironment
+}
+\newcommand\renewmultienvironment{%
+ \let\@multi@environment\renewenvironment
+ \@multienvironment
+}
+\newcommand\providemultienvironment{%
+ \@ifstar
+ {\@providemultienvironment*}%
+ {\@providemultienvironment{}}%
+}
+\def\@providemultienvironment#1#2{%
+ \@ifundefined{#2}%
+ {\newmultienvironment#1{#2}}%
+ {\begingroup\tracingall\renewcommand\@tempa[1][]{\renewcommand\@tempa[1][]{\expandafter\endgroup\@gobble}\@tempa}\@tempa}%
+}
+\def\@multienvironment{%
+ \@ifstar{%
+ \let\multienv@addcode\multienv@addcode@out
+ \newmultienvironment@marg
+ }{%
+ \let\multienv@addcode\multienv@addcode@in
+ \newmultienvironment@marg
+ }%
+}
+\long\def\newmultienvironment@marg#1{%
+ \@testopt{\newmultienvironment@oarg{#1}}{[0]}%
+}
+\long\def\newmultienvironment@oarg#1[#2]{%
+ \@ifnextchar[{%
+ \newmultienvironment@oargb{#1}{#2}%
+ }{%
+ \newmultienvironment@def{#1}{[#2]}%
+ }%
+}
+\long\def\newmultienvironment@oargb#1#2[#3]{%
+ \newmultienvironment@def{#1}{[#2][#3]}%
+}
+\long\def\newmultienvironment@def#1#2#3{%
+ \begingroup
+ \multienv@readkeys@{#3}%
+ \def\@tempa{\@multi@environment*{#1}#2}%
+ \@temptokena\expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter{\expandafter\begin@multienv\expandafter}\expandafter{\end@multienv}}%
+ \expandafter\expandafter\expandafter
+ \endgroup
+ \expandafter\@tempa\the\@temptokena
+}
+\long\def\multienv@readkeys#1{%
+ \multienv@readkeys@{#1}%
+ \begin@multienv
+}
+\long\def\multienv@readkeys@#1{%
+ \let\begin@multienv\@empty
+ \let\end@multienv\@empty
+ \multienv@readkeyval#1,\@nnil,\@nnil
+}
+\let\begin@multienv\@empty
+\let\end@multienv\@empty
+\long\def\multienv@readkeyval#1,{%
+ \ifx\@nnil#1\relax
+ \expandafter\@gobble
+ \else
+ \multienv@sepkeyval#1=\@nnil=\@nnil\relax
+ \expandafter\multienv@readkeyval
+ \fi
+}
+\long\def\multienv@sepkeyval#1=#2={%
+ \ifx\@nnil#2\relax
+ \multienv@handlekeyval{#1}{}%
+ \expandafter\@gobble
+ \else
+ \multienv@handlekeyval{#1}{#2}%
+ \expandafter
+ \@gobblefour
+ \fi
+}
+\long\def\multienv@handlekeyval#1#2{%
+ \@ifundefined{multienv@key@#1}{%
+ \multienv@addenv{#1}{#2}%
+ }{%
+ \@nameuse{multienv@key@#1}#2\@nnil
+ }%
+}
+\long\def\multienv@addenv#1#2{%
+ \@ifnextchar\bgroup{%
+ \multienv@@addenv
+ }{%
+ \ifcase0%
+ \expandafter\ifx\csname @let@token\endcsname\@nnil1\else
+ \expandafter\ifx\csname @let@token\endcsname[1\else
+ \expandafter\ifx\csname @let@token\endcsname<1\fi\fi\fi
+ \relax
+ \expandafter\multienv@@addenv@
+ \else
+ \expandafter\multienv@@addenv
+ \fi
+ }#2\@nnil{#1}%
+}
+\long\def\multienv@@addenv@#1\@nnil{%
+ \multienv@@addenv{{#1}}\@nnil
+}
+\long\def\multienv@@addenv#1\@nnil#2{%
+ \multienv@addcode{\multi@env{#2}#1}{\endmulti@env{#2}}%
+}
+\long\def\multi@env#1{%
+ \begingroup
+ \@ifundefined{#1}%
+ {\@latex@error{Environment #1 undefined}\@eha}%
+ {\csname #1\endcsname}%
+}
+\def\endmulti@env#1{\csname end#1\endcsname\endgroup}
+\long\def\multienv@addcode@out#1#2{%
+ \@temptokena{#1}%
+ \@temptokena\expandafter\expandafter\expandafter{\expandafter\the\expandafter\@temptokena\begin@multienv}%
+ \edef\begin@multienv{\the\@temptokena}%
+ \@temptokena\expandafter{\end@multienv#2}%
+ \edef\end@multienv{\the\@temptokena}%
+}
+\long\def\multienv@addcode@in#1#2{%
+ \@temptokena\expandafter{\begin@multienv#1}%
+ \edef\begin@multienv{\the\@temptokena}%
+ \@temptokena{#2}%
+ \@temptokena\expandafter\expandafter\expandafter{\expandafter\the\expandafter\@temptokena\end@multienv}%
+ \edef\end@multienv{\the\@temptokena}%
+}
+\long\@namedef{multienv@key@add code}#1\@nnil{%
+ \multienv@addcode#1{}{}%
+}
+\long\@namedef{multienv@key@adjustbox}#1\@nnil{%
+ \multienv@addcode{\csname adjustbox@noindent\endcsname\adjustbox{#1}\bgroup\ignorespaces}{\ifhmode\unskip\fi\egroup}%
+}
+\endinput
+%%
+%% End of file `multienv.sty'.