summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/gmutils/gmenvir.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-10-24 23:46:12 +0000
committerKarl Berry <karl@freefriends.org>2010-10-24 23:46:12 +0000
commite5d25989ee337ac9399ae9e50bed87559488814f (patch)
treee08fa9fe408fbbd07d82226b3fd8a059c8d39d7b /Master/texmf-dist/tex/latex/gmutils/gmenvir.sty
parent5d35798dc0ca224df75f912f020c70024e1a1169 (diff)
gmutils (24oct10)
git-svn-id: svn://tug.org/texlive/trunk@20183 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/gmutils/gmenvir.sty')
-rw-r--r--Master/texmf-dist/tex/latex/gmutils/gmenvir.sty141
1 files changed, 141 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/gmutils/gmenvir.sty b/Master/texmf-dist/tex/latex/gmutils/gmenvir.sty
new file mode 100644
index 00000000000..3348e8b0005
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/gmutils/gmenvir.sty
@@ -0,0 +1,141 @@
+%%
+%% \iffalse ^^A we skip the debug setting
+\IfFileExists{\string~/bin/gen_and_xela}{\errorcontextlines=1000 }{}
+%% \fi
+%% ^^A $Id: TheUltimateMaster.gmd,v 0.250 2010/10/24 14:42:35 natror Exp natror $
+%% This is file “gmenvir.sty” generated with the DocStrip utility.
+%%
+%%
+%% The original source files were:
+%%
+%% gmutils/gmutils.gmd (with options: `envir')
+%%
+%%
+%% Copyright ©
+%% by Grzegorz ‘Natror’ Murzynowski
+%% natror (at) o2 (dot) pl
+%%
+%% This program is subject to the LaTeX Project Public License.
+%% See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html
+%% for the details of that license.
+%%
+%% LPPL status: "author-maintained".
+%%
+%%
+%%
+%% For the documentation please refer to the file(s)
+%% gmutils.{gmd,pdf}.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{gmenvir}
+ [2010/10/24 v0.993 redefinition of \string \begin \space and \string \end (GM)]
+
+
+%%
+%%
+%% ^^A\typeout{\unexpanded{#4}}%%
+
+\RequirePackage{gmbase, gmampulex} % the low-level macros
+
+
+
+\emptify\@envirstack
+
+\def\@pushenvir{%
+ %^^V\edef\@currenvir{\@currenvir}% is already expanded.
+ \xdef\@envirstack{%
+ {\@xa\detokenize\@xa{\@currenvir}}%
+ {\the\currentgrouplevel}%
+ {\@currenvline}%
+ \@envirstack
+ }%
+}
+
+\def\@popenvir#1#2#3{%
+ \@XA{\@popenvir@#1#2#3}\@envirstack\@nil
+}
+
+\def\@popenvir@#1#2#3#4#5#6#7\@nil{%
+ \gdef#1{#4}% |#1| carries last envir name
+ \gdef#2{#5}% |#2| carries last envir level
+ \gdef#3{#6}% |#3| carries last envir beginnig line
+ \gdef\@envirstack{#7}% and we update the stack
+}
+
+\long\def\@begnamedgroup#1{%
+ \edef\@prevgrouplevel{\the\currentgrouplevel}% added 2009/03/24 to
+ % handle special pseudo-environments that don't increase
+ % \incmd\currentgrouplevel (such as \inenv{document}). Note it's
+ % |\edef|ed \emph{outside} the environment's group.
+ \@ignorefalse% not to ignore blanks after group
+ \begingroup\@endpefalse
+ \edef\@prevenvir{\@currenvir}% Note we |\edef| it inside the group
+ % (for obvious reason), unlike the ‘previous’ grouplevel.
+ \edef\@currenvir{#1}% We could do recatcoding
+ % through\inverb|\string| or \nlperc\cmd\detokenize\ but all the name
+ % `other' and 10 could affect
+ % a~thousand packages so we don't do that and we'll recatcode in
+ % a~testing macro, see line \ref{@ifenvir}.
+ \edef\@currenvline{\on@line}%
+ \@pushenvir % we put current envir to |\@envirstack|.
+ \csname #1\endcsname}% if the argument is a~command's name (an
+
+\def\begin{\gmu@ifstar{\@begnamedgroup}{%
+ \@begnamedgroup@ifcs}}
+
+\def\@begnamedgroup@ifcs#1{%
+ \ifcsname#1\endcsname\afterfi{\@begnamedgroup{#1}}%
+ \else\afterfi{\@latex@error{Environment #1 undefined}\@eha}%
+ \fi}%
+
+
+\long\def\@fourthofmany#1#2#3#4#5\@nil{#4}%
+
+\lpdef\@ifprevenvir#1{%\label{@ifenvir}\
+ % \begin{enumargs}
+ % \mand enquired environment name which will be confronted with
+ % \incs{@prevenvir}
+ % \mand what if true (if the names are
+ % equivalent\qfootnote{The names are checked whether they produce
+ % the same \cmd\csname. They don't have to have the same
+ % catcodes.})
+ % \mand what if false
+ % \end{enumargs}
+ %
+ % \changes{v0.92}{2009/09/04}{added}
+ % \chgs{2010/06/09 v0.993 made use \cmd\@envirstack}
+ %
+ % % \CH{2010/09/23 v0.993 to be precise, it's not a change but
+ % % rather a staus quo action: \cmd\gmu@ifedetokens suddenly turned
+ % % to be expandable and un\cmd\protected so we make \emph{this}
+ % % macro \cmd\protected}
+ \gmu@ifedetokens
+ {\@xa\@fourthofmany\@envirstack\relax\relax\relax\relax\@nil}%
+ {#1}}
+
+
+\def\@checkend#1{%
+ \@ifenvir{#1}%
+ {}%
+ {\@badend{#1}}%
+}
+
+\ampulexdef\end[#1][#1]\endcsname\@checkend{%
+\endcsname
+\@popenvir\gmu@drain\gmu@drain\gmu@drain
+\@checkend}
+
+\pdef\@endif#1{\@ifenvir{#1}{\end{#1}}{}}
+
+\pdef\@endifprev#1{\@ifprevenvir{#1}{\end{#1}}{}}
+
+
+%%% (For my GNU Emacs:)
+%%% Local Variables:
+%%% mode: doctex
+%%% coding: utf-8
+%%% End:
+\endinput
+%%
+%% End of file `gmenvir.sty'.